Re: Replace ZAVIS value using vbs (705 Views)
Reply
Occasional Advisor
a11an
Posts: 6
Registered: ‎10-11-2011
Message 1 of 9 (745 Views)
Accepted Solution

Replace ZAVIS value using vbs

Hello,

 

I am trying to amend the zavis value on aservice.  I'm currently amending a vbscript to do this but getting stuck on a Null value when executed.

 

Code:

---------------------------------------------------------------------------------------------------------------------------

p1 = ".\temp\ASERVICE"

Wscript.echo p1

buildHeaps=InstCount(p1)

 

'Get variable Name and value from Aservice, heap by heap 

FOR i = 0 to buildHeaps 

    CALL getVal1(p1,i,"ZOBJNAME") Next

....

 

Runtime error: (6, 1) Invalud use of Null

-------------------------------------------------------------------------------

 

 

Any help is appreciated.

 

Thanks,

Allan

Trusted Contributor
Pravs
Posts: 130
Registered: ‎03-04-2010
Message 2 of 9 (739 Views)

Re: Replace ZAVIS value using vbs

Hi,

 

Is this the complete code ? 

 

Secondly any specific reason of using vbs ?

 

-Praveen

Frequent Advisor
Dmitry Sh
Posts: 30
Registered: ‎07-31-2007
Message 3 of 9 (738 Views)

Re: Replace ZAVIS value using vbs

Hi Allan,

maybe rexx can be used instead? There are commands like 'edmget', 'edmset', there's a REXX guide at CAE media and CAE agent contains rex interpreter...

 

CALL EDMGET 'ASERVICE'
ASERVICE.ZAVIS = "XXX"
CALL EDMSET 'ASERVICE'

 

Dmitry.

 

Esteemed Contributor
Gowhar Jan
Posts: 212
Registered: ‎01-08-2009
Message 4 of 9 (723 Views)

Re: Replace ZAVIS value using vbs

Hi Allan,

 

What would you like to achieve by modifying the ZAVIS attribute for each heap in ASERVICE?

HPCA Agent would modify these values on the next connect anyway.

 

Do you intend to run update ASERVICE each time Agent connect runs?

 

Gowhar.

Occasional Advisor
a11an
Posts: 6
Registered: ‎10-11-2011
Message 5 of 9 (722 Views)

Re: Replace ZAVIS value using vbs

Hey Praveen,

 

Thanks for the response, this is just part of the code where it's getting stuck at the moment.

 

We use an existing vbs to amend EDM files, this is the only reason.

 

What other script can I use?

 

Thanks,

Allan

Occasional Advisor
a11an
Posts: 6
Registered: ‎10-11-2011
Message 6 of 9 (721 Views)

Re: Replace ZAVIS value using vbs

Hey Dmitry,

 

Thanks for the response, OK I'll have a look at REXX.

 

Ta,

Allan

Occasional Advisor
a11an
Posts: 6
Registered: ‎10-11-2011
Message 7 of 9 (719 Views)

Re: Replace ZAVIS value using vbs

Hey Jan,

 

I know, it's a bit complicated but to make it simple, we have some pretty old devices that haven't received a connect for some time and has some services that had been installed with a del=n with HQ reboot flag if removed.

 

So to get around it for now we want to change the zavis to YYYY.

 

Thanks,

Allan

Trusted Contributor
Pravs
Posts: 130
Registered: ‎03-04-2010
Message 8 of 9 (705 Views)

Re: Replace ZAVIS value using vbs

Hi,

 

if VBS is not a script requirement then we can use a tcl script as well . I have the below script from some source modified for this requirement . Please run this script using nvdkit -> " nvdkit <NAME OF THIS TCL FILE>  

 

 

-----------------------------------------------------------------------------------

 

nvd::init
log.configure -file C:/Users/TEST/Desktop/TEST.log -stderr 0 -mode a

set xpath C:/Users/TEST/Desktop/ASERVICE.EDM

set changed 0
set obj [nvdobj #auto -file $xpath -mode rw -lazy 1]
set nrows [ $obj cget -nrows ]
syslog info "Current number of ASERVICE heaps: $nrows "
for { set i 0 } { $i < $nrows } { incr i } {
set zobjname [ $obj get $i ZOBJNAME ]
# set REMOVAL to A
$obj put $i ZAVIS PRAV
syslog info "Changed $zobjname:"
set changed 1

}
if { $changed } { catch { $obj commit } }
delete object $obj
exit 0

 

------------------------------

 

The script opens the ASERVICE.EDM object present on the desktop and sets the ZAVIS flag of each heap to "PRAV". If you want this to happen only for a particular service then just filter this out based on zobjname.

 

It will create a log in the path mentioned ( TEST.log).

 

Hope it helps.

 

-Praveen

 

 

Occasional Advisor
a11an
Posts: 6
Registered: ‎10-11-2011
Message 9 of 9 (601 Views)

Re: Replace ZAVIS value using vbs

Hey Prav,

 

Thanks for your response, the tcl script you suggested worked perfectly.

 

Many thanks,

Al

 

 

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.