Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Query for specific patch installed system?


  • Please log in to reply
2 replies to this topic

#1 eric512

eric512

  • Members
  • 22 posts
  • OFFLINE
  •  
  • Local time:08:47 AM

Posted 17 March 2009 - 12:49 AM

I want to run a script or query to see if a specific patch number has been installed on a number of machines. Most all are XP.

For example - I want to ensure that KB958644 is install for Conflicker - for example. Digging through the Control Panel and Installed Programs is too time consuming to do in mass in an office (where no other tools exist).

I know the info is in the registry - so a script to query those keys would work too.

I just need some simple code to execute.

Aloha

BC AdBot (Login to Remove)

 


#2 thecollinshouse

thecollinshouse

  • Members
  • 3 posts
  • OFFLINE
  •  
  • Local time:01:47 PM

Posted 03 April 2009 - 06:50 AM

Hi,

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

Option Explicit

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
End If
Next
fPatchInstalled = blInstalled
End Function

[/codebox]

Edited by thecollinshouse, 03 April 2009 - 06:51 AM.


#3 thecollinshouse

thecollinshouse

  • Members
  • 3 posts
  • OFFLINE
  •  
  • Local time:01:47 PM

Posted 03 April 2009 - 06:56 AM

Ah - just found this:

http://www.microsoft.com/technet/scriptcen...05/hey0930.mspx

Better method but sloooooooow.

Edited by thecollinshouse, 03 April 2009 - 08:00 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users