Windows

Check Windows Last Update

Description:

Plugin calculates number of days since last success update.

Current Version

0.2

Last Release Date

2015-04-03

Compatible With

  • Nagios 3.x

License

GPL


Project Files
Project Notes
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) Add a Review
Error in Script
by norcon, July 31, 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 =



Works like a charm - except for one little fix
by brabax, July 31, 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 & "rootdefault: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 :)



Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
4.7 (3)
Favorites
0
Views
38,875