
Windows NRPE
Check Windows Updates
Description:
A check to see: – how many updates are available? – how many important and optional updates are available? – if system is awaiting for rebooting after installing updates
Current Version
Last Release Date
June 15, 2009
Compatible With
Owner
Project Files
File | Description |
---|---|
check_windows_updates.wsf | check_windows_updates.wsf |
COPYING | Licensce |
Project Notes
I was using coxwal's "Check for Windows Updates"
(http://www.nagiosexchange.org/Windows_NRPE.66.0.html?&tx_netnagext_pi1p_view=903&tx_netnagext_pi1page=10%3A10)
but it wasn't enough.
So I wrote this script which uses Windows Updates API to check which updates should be installed and also is checking if you need to reboot your system.
On May 2009 Albrecht Dress sent me new version. Now it's v.1.5.
Thanks for the update.
Parameters:
w - numbers of updates before warning level default 0
c - numbers of updates before critical level default 0
Result:
Warning - When you need to reboot your system.
Critical - When there is more than "c" updates awaiting for installation.
Warning - When there is more than "w" updates awaiting for installation.
OK - When there is less than "c" or "w" updates awaiting for installation.
commandwindows_updates=c:windowssystem32cscript.exe //NoLogo //T:120 c:nrpe_ntpluginscheck_windows_updates.wsf /w:0 /c:1
Reviews
(4)
Add a Review
Can you post a quick set of install instructions? I would like to get this installed on our network soon.
thanks a lot for this check!
since there are a lot of ms updates that are neither critical nor important, i wanted to have the test only check for a given subset of update-categories.
category scheme by microsoft can be found here:
[url]http://msdn.microsoft.com/en-us/library/windows/desktop/ff357803(v=vs.85).aspx[/url]
edit vbs to more complex search criteria:
[url]http://msdn.microsoft.com/en-us/library/windows/desktop/aa386526(v=VS.85).aspx[/url]
change code to this:
' critical updates E6CF1350-C01B-414D-A61F-263D14D133B4
' security updates 0FA1201D-4330-4FA8-8AE9-B877473B6441
Set searchResult = updateSearcher.Search("(IsInstalled=0 and Type='Software' and CategoryIDs contains '0FA1201D-4330-4FA8-8AE9-B877473B6441') or (IsInstalled=0 and Type='Software' and CategoryIDs contains 'E6CF1350-C01B-414D-A61F-263D14D133B4')")
since i am not a developer, please let me know if the code might be changed in a better way. at least it is working at my site. ;-)
sebastian
Great script.
I got an error due to win update being disabled. I've modified the script for this scenario. Put this in the top of "main":
''''''''''''''''''''''
' Main
''''''''''''''''''''''
Set objAutoUpdate = CreateObject("Microsoft.Update.AutoUpdate")
If objAutoUpdate.ServiceEnabled "True" Then
Wscript.Echo "Windows Update service disabled on client. Please enable."
Wscript.Quit(intCritical)
End If
Set objSettings = objAutoUpdate.Settings
If objSettings.NotificationLevel = 1 Then
Wscript.Echo "Windows Update notification level is set to 'Never check for updated (not recommended)' - please change to 'Check for updates but let me choose wether to download and install them' or higher."
Wscript.Quit(intCritical)
End If
intResultDetect = objAutoUpdate.DetectNow
...
This was just what I needed, although bear in mind that NRPE can only handle 1024b of data in the return (unless custom compile), so the script causes an error if you have a lot of updates.
Easy work around was the addition of a length check, and truncation if needed:
If intImportant > 0 Then
If Len(importantNames) > 970 Then
importantNames = Left(importantNames, 970) & "..."
End If
Page Sections
Project Stats
Rating
4.2 (5)
Favorites
0
Views
174,330