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
Test Registry-Key with WMI-Test
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
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:
Note 1: Script is designed for "Active Script" test method: http://www.ks-soft.net/hostmon.eng/mfra ... 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
Code: Select all
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 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