Freigeben über


How to get a list of updates

Today of my team members asked me, how to get a list of Office and Windows updates.

Surprisingly, I realized, that there is no easy way to do it (or at least I couldn’t find it ) – finally came up with following code snippets:

 'For getting a list of office updates
'--- --- --- --- --- --- --- --- --- 
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32Reg_AddRemovePrograms where DisplayName Like '%update%office%' OR DisplayName Like '%update%visio%' OR DisplayName Like '%update%word%' OR DisplayName Like '%update%excel%' OR DisplayName Like '%update%powerpoint%' OR DisplayName Like '%update%project%' ",,48 )
For Each objItem in colItems
    Wscript.Echo "DisplayName: " & objItem.DisplayName
    Wscript.Echo "InstallDate: " & objItem.InstallDate
    Wscript.Echo "ProdID: " & objItem.ProdID
    Wscript.Echo "Publisher: " & objItem.Publisher
    Wscript.Echo "Version: " & objItem.Version
Next

'--- --- --- --- --- --- --- --- --- 
 ' For getting a list of  Windows Updates

' -----------------------------------
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_QuickFixEngineering",,48)
For Each objItem in colItems
    Wscript.Echo "Caption: " & objItem.Caption
    Wscript.Echo "CSName: " & objItem.CSName
    Wscript.Echo "Description: " & objItem.Description
    Wscript.Echo "FixComments: " & objItem.FixComments
    Wscript.Echo "HotFixID: " & objItem.HotFixID
    Wscript.Echo "InstallDate: " & objItem.InstallDate
    Wscript.Echo "InstalledBy: " & objItem.InstalledBy
    Wscript.Echo "InstalledOn: " & objItem.InstalledOn
    Wscript.Echo "Name: " & objItem.Name
    Wscript.Echo "ServicePackInEffect: " & objItem.ServicePackInEffect
    Wscript.Echo "Status: " & objItem.Status
Next

'-----------------------------------

 

 

Technorati tags: Pranav+Wagh, Microsoft+Blogger, WMI, Office, Code+Snippet

IceRocket tags: Pranav+Wagh, Microsoft+Blogger, WMI, Office, Code+Snippet

Not responsible for errors in content, meaning, tact, or judgment. Live and let live. Toes go in first. I didn't do it. Enjoy.

Comments

  • Anonymous
    June 20, 2008
    PingBack from http://wordnew.acne-reveiw.info/?p=1082

  • Anonymous
    June 21, 2008
    Would have been a great opportunity to cross-promote and tell folks how you can do this using System Center ConfigMgr 2007.