Subscribe to RSS feed  Follow @jackvamvas - Twitter

*Use the Comments section for questions Links


SQL Server DBA Jobs

Use Powershell Get-Hotfix to get all hotfixes on Windows server

08 May,2014 by Tom Collins

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!



Read More

Powershell Scripts for DBA - SQL Server DBA

Powershell to HTML - SQL Server DBA

How to Convert Microsoft Word Format to HTML using Powershell

Export-CSV Powershell

SQL Server – Powershell Excel to HTML

Powershell , Excel charts and data presentation

Author: Tom Collins (


Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.


Post a comment on Use Powershell Get-Hotfix to get all hotfixes on Windows server | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer