Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Directory
brabax
bybrabax, July 27, 2014
This script works like a charm.
As promised it is very fast and solely takes a registry value instead of having windows search for updates (which almost always leads to a timeout).
There is only little glitch though:
When Windows was NEVER updated, the script will return an error stating that "CDate" cannot be created with a NULL value.
I fixed it by editing the script thusly (maybe if someone has a more reliable check for NULL, please feel free to add a it):
[Snippet starts at line 26 of check_win_lastupdate.vbs] ----------------------
strComputer & "\root\default:StdRegProv")
objReg.GetStringValue HKEY_LOCAL_COMPUTER, strKeyPath, strEntryName, strValue
'-----------------------------------
if IsNull(strValue) = -1 then
Wscript.Echo "CRITICAL: Patches have NEVER been applied!"
Wscript.Quit(intCritical)
end if
'-----------------------------------
InstallDate = CDate(strValue)
CurrentDate = CDate(Now)
[...]
----------------------------------------------
Thanks for the script :)
As promised it is very fast and solely takes a registry value instead of having windows search for updates (which almost always leads to a timeout).
There is only little glitch though:
When Windows was NEVER updated, the script will return an error stating that "CDate" cannot be created with a NULL value.
I fixed it by editing the script thusly (maybe if someone has a more reliable check for NULL, please feel free to add a it):
[Snippet starts at line 26 of check_win_lastupdate.vbs] ----------------------
strComputer & "\root\default:StdRegProv")
objReg.GetStringValue HKEY_LOCAL_COMPUTER, strKeyPath, strEntryName, strValue
'-----------------------------------
if IsNull(strValue) = -1 then
Wscript.Echo "CRITICAL: Patches have NEVER been applied!"
Wscript.Quit(intCritical)
end if
'-----------------------------------
InstallDate = CDate(strValue)
CurrentDate = CDate(Now)
[...]
----------------------------------------------
Thanks for the script :)