Welcome to MSDN Blogs Sign in | Join | Help

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

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

 

 



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

Published Saturday, June 21, 2008 5:25 AM by Pranav Wagh
Filed under: ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

Friday, June 20, 2008 8:02 PM by Pregnant Man » How to get a list of updates

# Pregnant Man » How to get a list of updates

Saturday, June 21, 2008 3:42 PM by Rod Trent

# re: How to get a list of updates

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

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker