Request for amendment to AHM supplied script - RegRead.vbs

Need new test, action, option? Post request here.
Post Reply
FLynch
Posts: 75
Joined: Tue Jun 18, 2002 6:00 pm
Location: London UK

Request for amendment to AHM supplied script - RegRead.vbs

Post by FLynch »

Hi,

I am really exposing my programming ignorance here but it would be great if the guys at AHM or any other of you bright sparks could help me out with a specific active script.

I am trying to amend "RegRead.vbs" to read a registry key on a remote machine (the script works fine when run locally). I do not want to run RMA on the machines I am trying to monitor.

I am at a loss as how to start. I should imagine its some variation of prefixing the const with some form of "\\servername\".

Actually all I need to do is read a remote registry key and not compare it to any thing else, which is what RegRead.vbs was designed to do.

Thanks in Advance (!)
Fergus

***********************************************
Option Explicit

const statusAlive = "Host is alive:"
const statusDead = "No answer:"
const statusUnknown = "Unknown:"
const statusNotResolved = "Unknown host:"
const statusOk = "Ok:"
const statusBad = "Bad:"
const statusBadContents = "Bad contents:"

const IEkey = "HKCU\Software\Microsoft\Internet Explorer\Main\Start Page"

'---- entry point ----

FUNCTION performtest()
Dim WshShell, KeyStr
IF "%Reply%"="%"+"Reply"+"%" THEN
performtest = statusUnknown+"Please enable 'Translate macros' option"
ELSE
Set WshShell = CreateObject("WScript.Shell")
KeyStr = WshShell.RegRead(IEkey)
IF (KeyStr<>"%Reply%") THEN
performtest = statusBad+KeyStr
ELSE
performtest = statusOk+KeyStr
END IF
END IF
END FUNCTION


****************************************
KS-Soft
Posts: 12903
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

IMHO WScript.Shell object cannot work with remote registry. You should use WMI winmgmts object instead:
http://msdn2.microsoft.com/en-us/library/aa394600.aspx

There are some more options:
http://www.ks-soft.net/cgi-bin/phpBB/vi ... php?t=1494

Regards
Alex
FLynch
Posts: 75
Joined: Tue Jun 18, 2002 6:00 pm
Location: London UK

Cheers!

Post by FLynch »

Thanks all.... ther is plenty here for me to start looking at..
FLynch
Posts: 75
Joined: Tue Jun 18, 2002 6:00 pm
Location: London UK

Location of VB script files on remote servers

Post by FLynch »

Hi All,

I'm trying to run an Active Script with RMA on a remote server however I have hit a small problem with Active Scripts. All other types of monitor are working great!

When I add an active script monitor using RMA I get an error message:

Error: Cannot open file " c:\Program Files\AHM\script.vbs"

When I test the script while setting up the monitor it runs Ok.

Any ideas on this one?

Thanks in Advance
Fergus
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Re: Location of VB script files on remote servers

Post by KS-Soft Europe »

FLynch wrote:Error: Cannot open file " c:\Program Files\AHM\script.vbs"
When "Active script" test method is performed by RMA, it assumes that script is located on the machine, where RMA is running. So, RMA is looking for "script.vbs" in "c:\Program Files\AHM" folder on RMA's machine.

Regards,
Max
KS-Soft
Posts: 12903
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

3 possible solutions:
a) store script in a file on system where RMA is running
b) or you may use "Store script inside HML file" option of the test
c) or you may use Shell Script test method instead

Regards
Alex
FLynch
Posts: 75
Joined: Tue Jun 18, 2002 6:00 pm
Location: London UK

Resolved!

Post by FLynch »

Thanks for all the help on this - now working perfectly.

Basically I re-installed the RMA software using the supplied installer and choosing the "custom" option.

RMA is absolutely superb!

Cheers
Fergus
KS-Soft
Posts: 12903
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Glad it works fine

Regards
Alex
Post Reply