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


Remember Me

Directory Tree

Check Windows Updates

5 votes
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
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
I was using coxwal's "Check for Windows Updates"
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.

w - numbers of updates before warning level default 0
c - numbers of updates before critical level default 0

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:\windows\system32\cscript.exe //NoLogo //T:120 c:\nrpe_nt\plugins\check_windows_updates.wsf /w:0 /c:1
Reviews (4)
byCyber Saiyan, February 22, 2016
Can you post a quick set of install instructions? I would like to get this installed on our network soon.
bysebp, December 1, 2011
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:

edit vbs to more complex search criteria:

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. ;-)

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."
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."
End If

intResultDetect = objAutoUpdate.DetectNow

byGrenage, January 31, 2011
1 of 1 people found this review helpful
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