|
View previous topic :: View next topic |
Author |
Message |
Seitter
Joined: 08 Jan 2003 Posts: 27
|
Posted: Mon Aug 13, 2007 2:59 am Post subject: Test Registry-Key with WMI-Test |
|
|
I want to test the content of a registry-key,
the key is: HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\ePolicy Orchestrator\Application Plugins\VIRUSCAN8600
the name is datdate
the content is a date value like 08/10/2007
the typ is : REG_SZ
The Test is bad when the value is older then 4 days
Is there a way to do this with Hostmonitor
Regards
Wolfgang |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Mon Aug 13, 2007 4:42 am Post subject: |
|
|
You may copy the following script into into some file with .js extension (e.g. read_reg_data.js) and use it with "Active Script" test method:
Code: | statusAlive = "Host is alive:"
statusDead = "No answer:"
statusUnknown = "Unknown:"
statusNotResolved = "Unknown host:"
statusOk = "Ok:"
statusBad = "Bad:"
statusBadContents = "Bad contents:"
AlertThreshold = 4;
Datekey = "HKLM\\Software\\Network Associates\\ePolicy Orchestrator\\Application Plugins\\VIRUSCAN8600\\datdate"
//---- entry point ----
function performtest()
{
var WshShell, KeyStr;
var CurrDate = new Date();
WshShell = new ActiveXObject ("WScript.Shell");
KeyStr = WshShell.RegRead(Datekey);
var Month = KeyStr.substr(0,2);
var Day = KeyStr.substr(3,2);
var Year = KeyStr.substr(6,4);
var CheckDate = new Date(Year,--Month,Day);
if (compareDate(CurrDate,CheckDate) > AlertThreshold) return (statusBad+KeyStr); else return (statusOk+KeyStr);
}
function compareDate(d1,d2) {
return (d1-d2)/86400000;
} |
Note 1: Script is designed for "Active Script" test method: http://www.ks-soft.net/hostmon.eng/mframe.htm#tests.htm#script
Note 2: Expected date format is mm/dd/yyyy (i.e. 08/10/2007)
Note 3: You have to select "JScript" from "Language" input box in "Test Properties" window of "Active script" test to make it work.
Regards,
Max |
|
Back to top |
|
|
|
|
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
|