February 2010 - Posts

VBS Script To Verify If A List Of Hot fixes Is Installed On A Specified Computer

 

This VBS script is a modified version of my previous post below that will read a list of hot fixes stored in a text file called Hotfixes.Txt with the following format:

 

KB898461

WMFDist11

KB923561

 

The script will then list all of the hot fixes in the text file and whether or not the hot fix is installed along with the install short date if it is installed.

 

VBS Script:

 

strComputer = InputBox ("Enter Machine Name")

 

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

intRow = 2

 

objExcel.Cells(1, 1).Value = "HotFix"

objExcel.Cells(1, 2).Value = strHotFixId & " Install Date"

 

Set Fso = CreateObject("Scripting.FileSystemObject")

Set InputFile = fso.OpenTextFile("HotFixes.Txt")

Do While Not (InputFile.atEndOfStream)

strHotFixId = InputFile.ReadLine

 

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery( _

"Select * from Win32_QuickFixEngineering Where HotFixID ='" & strHotFixId & "'")

 

If colItems.Count > 0 Then

For Each objItem In colItems

objExcel.Cells(intRow, 1).Value = strHotFixId

objExcel.Cells(intRow, 2).Value = objItem.InstalledOn

Next

Else

objExcel.Cells(intRow, 1).Value = strHotFixId

objExcel.Cells(intRow, 2).Value = "Not Installed"

If objExcel.Cells(intRow, 2).Value = "Not Installed" Then

objExcel.Cells(intRow, 1).Font.ColorIndex = 3

objExcel.Cells(intRow, 2).Font.ColorIndex = 3

Else

End If

End If

 

intRow = intRow + 1

Loop

 

objExcel.Range("A1:B1").Select

objExcel.Cells.HorizontalAlignment = 2

objExcel.Selection.Interior.ColorIndex = 19

objExcel.Selection.Font.ColorIndex = 11

objExcel.Selection.Font.Bold = True

objExcel.Cells.EntireColumn.AutoFit

 

MsgBox "Done"

 

 

VBS Script To Verify If A Specified Hot Fix Is Installed On A List Of Remote Machines

http://myitforum.com/cs2/blogs/dhite/archive/2007/08/05/vbs-script-to-verify-if-a-specified-hot-fix-is-installed-on-a-list-of-remote-machines.aspx

 

 

Posted by dhite | with no comments
Filed under: