BRONZE PARTNER:
BRONZE PARTNER:
Industry News:

| |
| |
 |
 |
 |
 |
 |
| PowerShell script to check if a particular patch installed |
 |
|
|
By: Ying Li
Posted On: 5/4/2007
Here is a PS script to check if a particular patch are applied to a list of machines and you can replace the KB number.
This article was Previously posted on Ying Li's Blog
$erroractionpreference = "SilentlyContinue"
$a = New-Object -comobject Excel.Application $a.visible = $True
$b = $a.Workbooks.Add() $c = $b.Worksheets.Item(1)
$c.Cells.Item(1,1) = "Machine Name" $c.Cells.Item(1,2) = "PatchStatus" $c.Cells.Item(1,3) = "Report Time Stamp"
$d = $c.UsedRange $d.Interior.ColorIndex = 19 $d.Font.ColorIndex = 11 $d.Font.Bold = $True
$intRow = 2
Foreach ($strComputer in get-content C:\MachineList.Txt) { $c.Cells.Item($intRow,1) = $strComputer
$PatchStatus = Get-WMIObject Win32_QuickFixEngineering -computer $strcomputer |where {$_.HotFixID -eq "KB925902"} If($PatchStatus -eq $Null) { $c.Cells.Item($intRow,2).Interior.ColorIndex = 3 $c.Cells.Item($intRow,2) = "NO" } Else { $c.Cells.Item($intRow,2).Interior.ColorIndex = 4 $c.Cells.Item($intRow,2) = "YES" } $c.Cells.Item($intRow,3) = Get-Date $intRow = $intRow + 1 }
$d.EntireColumn.AutoFit() cls
|
 |
 |
 |
|
|