I had to check some of our servers today for a number of updates so rather than logon to each one individually I created a little PowerShell script.

You will need to create 2 text files, one called computers.txt and one called updates.txt ideally saved in the same folder as the script. The contents of each should be obvious (I hope!).

$computers=Get-Content .computers.txt
$Kbs=Get-Content .updates.txt
$ErrorActionPreference=“SilentlyContinue”;

ForEach ($computerin$computers) {
add-content“———————— $computer ——————————————————-“-path .hotfixes.txt
ForEach ($Kbin$Kbs) {
$Info=$null
$Info=Get-HotFix-cn$computer-ID$Kb
if ($Info-eq$null) {
add-content$Kb not installed”-path .hotfixes.txt
}
else {
$InstalledDate=$Info.InstalledOn
add-content$Kb installed $InstalledDate-path .hotfixes.txt
}
}
}

It will give you something along the lines of the below:

 

Hope it helps!

About the author