Get Patch and Service Pack Information via PowerShell

Posted By on Dec 17, 2012 | 0 comments


Both examples below assume you have a text file with a list of your hostnames to query against:

 

Get Service Pack Info:

$c= get-content “C:servers.txt”
foreach ($i in $c)
{
get-wmiobject win32_operatingsystem -computer $i | select ` csname,caption,servicepackmajorversion
}

 

Get Patch Info:

$c= get-content “C:servers.txt”
foreach ($i in $c)
{
Get-WmiObject -Computer $i -Class Win32_QuickFixEngineering -filter “HotFixID=’KB2742599′”
}