Nerd-cen-tric, adj. 1. Holding the view that technology is the center, object, and norm of all experience.

Checking Patch History on a Remote System

So ya need to see what patches are applied to a few remote systems?  Here’s a quick method using a VB script to do just that.  The first batch file is just to get Script Zombie to execute the VBScript using cscript.

runPatchHist.cmd

@echo off
echo.
echo -Patch History for (%1)
echo.
cscript scripts\helpers\patchHistory.vbs %1

patchHistory.vbs

‘Get passed hostname from Script Zombie
 remoteSystem = WScript.Arguments.Item(0)
Set objSession = CreateObject(“Microsoft.Update.Session”, remoteSystem)
 Set objSearcher = objSession.CreateUpdateSearcher
 intHistoryCount = objSearcher.GetTotalHistoryCount
 Set colHistory = objSearcher.QueryHistory(1, intHistoryCount)
For Each objEntry in colHistory
 Wscript.Echo “Operation: ” & objEntry.Operation
 Wscript.Echo “Result code: ” & objEntry.ResultCode
 Wscript.Echo “Date: ” & objEntry.Date
 Wscript.Echo “Title: ” & objEntry.Title
 Wscript.Echo “Description: ” & objEntry.Description
 Wscript.Echo “Client application ID: ” & objEntry.ClientApplicationID
 Wscript.Echo “Server selection: ” & objEntry.ServerSelection
 Wscript.Echo “Service ID: ” & objEntry.ServiceID
 i = 1
 For Each strStep in objEntry.UninstallationSteps
 Wscript.Echo i & ” — ” & strStep
 i = i + 1
 Next
 Wscript.Echo “Uninstallation notes: ” & objEntry.UninstallationNotes
 Wscript.Echo “Support URL: ” & objEntry.SupportURL
 Wscript.Echo
 Next

After working on this script I realized it probably would be a good idea to have Script Zombie watch for a .VBS extension on a script.  If one is found run “cscript c:\path\scriptname.vbs”.  That way there would be no need for a helper .cmd file to run “cscript” and pass the hostname.

Leave a Reply

You must be logged in to post a comment.

Nerdcentric Twitter Feed