====== Windows Update Check ====== ^ Author | [[ plennon@automated-knowledge.com | Padraig Lennon ]] | ^ Compatibility | Xymon 4.2+ | ^ Requirements | Windows Update API (Should be installed by default) | ^ Download | winupd.vbs | ^ Last Update | 2009-06-26 | ===== Description ===== Simple check to see if there are any pending reboot required to finish applying system updates (patches) ===== Installation ===== Copy the code below to a file called **winupd.vbs** in the **BBWIN_HOME/ext folder** Add the following to bbwin.cfg in the **** section === Client side === === Server side === ===== Source ===== ==== winupd.vbs ==== '========================================================================== ' 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 & "

Windows Update Check

" & 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
===== Known Bugs and Issues ===== None known at present ===== To Do ===== * Enhance to check for outstanding critical updates not applied * Allow configurable thresholds for outstanding patches before alerting ===== Credits ===== ===== Changelog ===== * **2009-06-26** * Initial release