Home Directory Plugins Operating Systems Windows Check Windows Last Update

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Check Windows Last Update

Rating
3 votes
Favoured:
0
Current Version
0.2
Last Release Date
2015-04-03
Compatible With
  • Nagios 3.x
License
GPL
Hits
33602
Files:
FileDescription
check_win_lastupdate.vbscheck_win_lastupdate.vbs

Help Support Ethan Galstad's New Project:

Help Support Ethan

A Message From The Founder...

As the founder of Nagios, I'm asking for your help in a cause that's dear to my heart.

I'm launching a new project to help better the world by providing the information, ideas, and inspiration that I believe can improve the lives of people everywhere.

I know you're busy managing networks, but I would appreciate it if you would consider liking my Facebook page and showing your support for the content and messages I produce by sharing them with your friends and family.

You can learn more about my project by visiting ethangalstad.me/nagios. Thank you for your time. I wish you all the best in your endeavors, whatever they may be.

- Ethan

Plugin calculates number of days since last success update.
Plugin calculates number of days since last success update using "LastSuccessTime" Windows registry key.The same date you can find in Windiows updates log. Plugin is tested with NSClient++ v 0.4, NSCP-0.4.x.
strKeyPath = "SOFTWAREMicrosoftWindowsCurrentVersionWindowsUpdateAuto UpdateResultsInstall"
strEntryName = "LastSuccessTime" (Value Data).

Usage: cscript check_win_lastupdate.vbs /w:90 /c:120

Script is working on localhost, so you should use for example NRPE and add this line in nsclient.ini in section [/settings/external scripts/scripts]

check_win_lastupdate=cscript.exe //T:30 //NoLogo scripts/check_win_lastupdate.vbs /w:$ARG1$ /c:$ARG2$
Reviews (2)
bynorcon, July 21, 2015
Hi Guys,

there is an Error in your Script. If you set the warning ord critical date to for example 30 and 60 Days, the script will work until the days since last update is excactly 30 or 60 days. 31 or 61 or 29 or 59 will work.

You have to modify your if and elseif at the end to = insted of

See here the edited code snipped:

If DD >= updateTresholdCritical Then
Wscript.Echo "CRITICAL: Patches are not applied for the last " & DD & " days."
Wscript.Quit(intCritical)

ElseIf DD >= updateTresholdWarning Then
Wscript.Echo "WARNING: Patches are not applied for the last " & DD & " days."
Wscript.Quit(intWarning)

ElseIf DD =
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 :)