KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

Request for amendment to AHM supplied script - RegRead.vbs

 
Post new topic   Reply to topic    KS-Soft Forum Index -> Wish list
View previous topic :: View next topic  
Author Message
FLynch



Joined: 18 Jun 2002
Posts: 75
Location: London UK

PostPosted: Thu Apr 12, 2007 8:31 am    Post subject: Request for amendment to AHM supplied script - RegRead.vbs Reply with quote

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


****************************************
Back to top
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12792
Location: USA

PostPosted: Thu Apr 12, 2007 4:40 pm    Post subject: Reply with quote

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/viewtopic.php?t=1494

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
FLynch



Joined: 18 Jun 2002
Posts: 75
Location: London UK

PostPosted: Fri Apr 13, 2007 8:17 am    Post subject: Cheers! Reply with quote

Thanks all.... ther is plenty here for me to start looking at..
Back to top
View user's profile Send private message
FLynch



Joined: 18 Jun 2002
Posts: 75
Location: London UK

PostPosted: Tue Apr 17, 2007 1:04 am    Post subject: Location of VB script files on remote servers Reply with quote

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
Back to top
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Tue Apr 17, 2007 1:26 am    Post subject: Re: Location of VB script files on remote servers Reply with quote

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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
KS-Soft



Joined: 03 Apr 2002
Posts: 12792
Location: USA

PostPosted: Tue Apr 17, 2007 5:01 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
FLynch



Joined: 18 Jun 2002
Posts: 75
Location: London UK

PostPosted: Tue Apr 24, 2007 10:09 am    Post subject: Resolved! Reply with quote

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
Back to top
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12792
Location: USA

PostPosted: Tue Apr 24, 2007 9:14 pm    Post subject: Reply with quote

Glad it works fine

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> Wish list All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

KS-Soft Forum Index