08 May,2014 by Jack Vamvas
Question: How can I get all hotfixes on a Windows Server? Also, I’d like to compare list of hotfixes on 2 different servers?
I’ve read the post , and this returns the software ,How to get a list of software installed on a server using Powershell. But I’m looking for hotfixes
Answer: The Powershell cmdlet Get-Hotfix returns all hotfixes applied to a server.
To get a list of hotfixes on a server
#I’ve included installed on get-hotfix –ComputerName SERVER1| select hotfixid, installedon | sort-object hotfixid
To compare 2 servers , use the Powershell utility cmdlet Compare-Object to compare the output.
Step 1: create the 2 output files – one for each server.
get-hotfix -ComputerName server1| select hotfixid | sort-object hotfixid > C:\server1.txt get-hotfix -ComputerName server2| select hotfixid | sort-object hotfixid> C:\server2.txt
Step 2 : Compare the 2 output files and report on any differences. The Compare-Object cmdlet compares two objects and let’s you know the difference
Compare-Object -ReferenceObject (Get-Content C:\server1.txt) -DifferenceObject (Get-Content server2.txt)
This is an example of the Compare-Object cmdlet. This result indicates the hotfixes exist on server1 but do not exist on server2. This is very useful information for troubleshooting sudden problems due to a patch install!