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
****************************************
Request for amendment to AHM supplied script - RegRead.vbs
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
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
Location of VB script files on remote servers
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
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
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
Re: Location of VB script files on remote servers
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.FLynch wrote:Error: Cannot open file " c:\Program Files\AHM\script.vbs"
Regards,
Max