12 April 2012

List Installed Windows 7 Updates

You are looking for a list of all installed updates on a machine for either identifying what has not been installed, or like myself, to find the list so that you know what is needed to download to include in the MDT/SCCM build. I have written this VBScript that will parse through and output all installed updates on a Windows 7 machine. The output is in csv format so that it can easily be opened up in Microsoft Excel.

Here is a link to the file for downloading and the code is just below:

   
 '*******************************************************************************  
 '     Program: ListUpdates.vbs  
 '      Author: Mick Pletcher  
 '        Date: 12 April 2012  
 '    Modified:  
 '  
 ' Description: This will output a list of all installed updates to a csv file  
 '*******************************************************************************  
 REM Define Local Variables  
 DIM strComputer : strComputer = "."  
    
 REM Define Local Objects  
 DIM FSO           : Set FSO = CreateObject("Scripting.FileSystemObject")  
 DIM objFile       : Set objFile = FSO.CreateTextFile("Updates.csv", True)  
 DIM objHotfixFile : Set objHotfixFile = FSO.OpenTextFile("Updates.csv", 1,True)  
 DIM objWMIService : Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" _  
                     & strComputer & "\root\cimv2")  
 DIM colQuickFixes : Set colQuickFixes = objWMIService.ExecQuery _  
                     ("Select * from Win32_QuickFixEngineering")  
   
    
 For Each objQuickFix in colQuickFixes  
      objFile.WriteLine(objQuickFix.Description & Chr(44) & objQuickFix.HotFixID)  
 Next  
 Wscript.Echo "Done"  
 objFile.Close  
   
 REM Cleanup Local Objects and Variables  
 Set colQuickFixes = Nothing  
 Set FSO           = Nothing  
 Set objFile       = Nothing  
 Set objHotfixFile = Nothing  
 Set objWMIService = Nothing  
 Set strComputer   = Nothing  

0 comments:

Post a Comment