Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to compare the installed patches between a dev and production environment using PowerShell. How can I do this?

share|improve this question
up vote 11 down vote accepted

I recently blogged about this problem and came up with this script. You can either run it as a user that is administrator on both machines, or use the -Credential option on the get-hotfix commands.

$server1 = Read-Host "Server 1"
$server2 = Read-Host "Server 2"

$server1Patches = get-hotfix -computer $server1 | Where-Object {$_.HotFixID -ne "File 1"}

$server2Patches = get-hotfix -computer $server2 | Where-Object {$_.HotFixID -ne "File 1"}

Compare-Object ($server1Patches) ($server2Patches) -Property HotFixID
share|improve this answer
Never knew about get-hotfix. Great nugget of information there. – Mike Nov 13 '12 at 17:27
Be careful when using Get-Hotfix, it only reports a subset of patches. See this Hey Scripting Guy article for more information. @Mike – Ashley Steel Mar 3 '14 at 18:12
$machine1=Read-Host "Enter Machine Name 1:-"
$machine2=Read-Host "Enter Machine Name 2:-"
$machinesone=@(Get-wmiobject -computername  $machine1 -Credential Domain\Adminaccount -query 'select hotfixid from Win32_quickfixengineering')
$machinestwo=@(Get-WmiObject -computername $machine2  -Credential Domain\Adminaccount -query 'select hotfixid from Win32_quickfixengineering')
Compare-Object -RefernceObject $machinesone -DiffernceObject $machinestwo -Property hotfixid
share|improve this answer
Can you explain how querying WMI could be better than running native powershell against each host? – blaughw Apr 29 '15 at 0:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.