Comparing Services

by Dec 31, 2010

Compare-Object can help when troubleshooting computers. For example, you should try this to compare the service status on two machines and find out where services are configured differently:

$machine1 = Get-Service -ComputerName server1-or-IP1
$machine2 = Get-Service -ComputerName server2-or-IP2
Compare-Object -ReferenceObject $machine1 -DifferenceObject $machine2 -Property Name,Status `
-passThru | Sort-Object Name | Select-Object Name, Status, MachineName

Twitter This Tip!
ReTweet this Tip!