Windows Update Check

Author Padraig Lennon
Compatibility Xymon 4.2+
Requirements Windows Update API (Should be installed by default)
Download winupd.vbs
Last Update 2009-06-26

Simple check to see if there are any pending reboot required to finish applying system updates (patches)

Copy the code below to a file called winupd.vbs in the BBWIN_HOME/ext folder

Add the following to bbwin.cfg in the <externals> section

	<load value="cscript //B ..\ext\winupd.vbs" timer="120s" /> 

Client side

Server side

winupd.vbs

Show Code ⇲

Hide Code ⇱

'==========================================================================
' NAME: Windows Update Check
' COMMENT: Simple Check for Pending Reboots to finish applying updates
' AUTHOR: Padraig Lennon 
' EMAIL: padraig.lennon@pioneerinvestments.com
' HISTORY
' VERSION : 1.00 25/06/2009 Initial Development
' Requires :  No Requirements at present
'==========================================================================
 
On Error Resume Next
 
Dim objShell
Dim typelib,ServerName,boolValid
Dim strLayout,strSize,strLine,intStart,strFail,strCmd
 
' Set Variables and get the Server Name
Set objShell = WScript.CreateObject("WScript.Shell")

 
ServerName = objShell.ExpandEnvironmentStrings("%COMPUTERNAME%")
 
' User definable section
 
strTestName = "winupd" 	' Change this to what you want the test column to be.
 
strAlarmState = "green"
strOutput   = ""

Set oShell = WScript.CreateObject("WScript.Shell")
' Check to see If used with BBWin or Big Brother client and set extPath.
extPath = oShell.RegRead("HKLM\SOFTWARE\BBWin\tmpPath")
If extPath = "" Then
	extPath = oShell.RegRead("HKLM\SOFTWARE\Quest Software\BigBrother\bbnt\ExternalPath\")
End If


' ========================================
' Main Code Starts Here
 
strOutput = strOutput & vbcrlf & "<h2>Windows Update Check</h2>" & vbcrlf 

Set objSysInfo = CreateObject("Microsoft.Update.SystemInfo")

If objSysInfo.RebootRequired Then
	strAlarmState = "red"
	strOutput = strOutput & vbcrlf & "&" & strAlarmState & " Reboot Required to finish applying updates" & vbcrlf & vbcrlf
Else
	strAlarmState = "green"
	strOutput = strOutput & vbcrlf & "&" & strAlarmState & " All updates applied. NO reboot required" & vbcrlf & vbcrlf
End If

		
' Write the file for BB
WriteFile extPath, strTestName, strAlarmState, strOutput
 
'===========================================================
' FUNCTIONS and SUBS start here
 
' This SUB is used for outputting the file to the external's directory in bbwin
SUB WriteFile(strExtPath, strTestName, strAlarmState, strOutput)
    Set fso = CreateObject("Scripting.FileSystemObject")	
    strOutput = strAlarmState & " " & Date & " " & LCase(Time) & " " & LCase(ServerName) & vbcrlf & strOutput & vbcrlf
    Set f = fso.OpenTextFile(strExtPath & "\" & strTestName , 8 , TRUE)
    f.Write strOutput
    f.Close
    Set fso = Nothing
END Sub

None known at present

  • Enhance to check for outstanding critical updates not applied
  • Allow configurable thresholds for outstanding patches before alerting
  • 2009-06-26
    • Initial release
  • monitors/winupd.txt
  • Last modified: 2009/11/23 06:12
  • (external edit)