Script to find out if updates are installed on a number of servers

By |2017-12-08T17:00:09+00:00April 13th, 2015|Azure, Cloud, Windows|0 Comments

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!

Leave A Comment

like what you see? 

Sign-up to our newsletter and never miss out on the latest blogs, events and tech news from the world of risual
SUBSCRIBE!
Give it a try, you can unsubscribe anytime.