Comparing Services

Share |

Join PowerShell.com!
Subscribe to Feed

PowerShell eBook
Sign up for
Your PowerTip of the Day:

Award-winning PowerShellPlus


Admin Guide to PowerShell Remoting


Mastering PowerShell eBook

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!


Posted Dec 31 2010, 08:00 AM by ps1
Copyright 2012 PowerShell.com. All rights reserved.