I have just written the following vbScript function. If computer name is just a dot '.' then the computer is local. If you have the permissions on your network you can type in a remote computer to check.
This will work on XP, but will NOT work for Vista. Vista does not use the Win32_QuickFixEngineering class in the same way.
[codebox]'# D.Collins - 12:42 03/04/2009
'# Tests to see if a patch is installed that contains the text of the test text.
'# e.g. if testing for 951066, then if patch KB951066 is installed it will return True
'# be careful because if testing for 1066 then KB951066 will be True but it will also return True for KB821066
Dim strPatch, strComputer, blInstalled
strPatch = InputBox("Enter Patch Name:","Patch Test","KB")
strComputer = InputBox("Enter Computer Name:","Patch Test",".")
If strComputer = "" Then WSCript.Quit
blInstalled = fPatchInstalled(strComputer, strPatch)
MsgBox "Patch " & strPatch & " Installed = " & blInstalled
Function fPatchInstalled(sComputer, sPatch)
Dim oWMI, colItems, oItem, blInstalled
Set oWMI = GetObject("winmgmts:\\" & sComputer & "\root\CIMV2")
Set colItems = oWMI.ExecQuery("Select * from Win32_QuickFixEngineering",,48)
blInstalled = False
For Each oItem In colItems
If InStr(1, oItem.HotFixID, sPatch, 1) <> 0 Then
blInstalled = True
fPatchInstalled = blInstalled
Edited by thecollinshouse, 03 April 2009 - 06:51 AM.