I want powershell to Compare a few XML files that contain services, status and computernames. That include all of these in the output but only use Name and Status for comparison. The Idea is to get an output like so:
Name Status SideIndicator PSComputername
---- ------ ------------- --------------
Appinfo Running <=
Appinfo Stopped =>
AudioEndpointBuilder Stopped =>
AudioEndpointBuilder Running <=
As you can see the table looks nice but it doesn't include the computernames... Anybody got an idea to help out? This is what the code looks like.
$WBService1 = Invoke-Command $WB1 -Credential ($WBCred) -ScriptBlock {Get- Service} |
Select-Object Name, Status, DisplayName, PSComputerName |
Sort-Object Name
$WBService2 = Invoke-Command $WB2 -Credential ($WBCred) -ScriptBlock {Get-Service} |
Select-Object Name, Status, DisplayName, PSComputerName |
Sort-Object Name
$WBService1 | Export-Clixml $FileOutput\WBService1.xml
$WBService2 | Export-Clixml $FileOutput\WBService2.xml
$Service1 = Import-Clixml $FileOutput\WBService1.xml
$Service2 = Import-Clixml $FileOutput\WBService2.xml
Compare-Object $Service1 $Service2 -Property Name, Status | Sort-Object Name | Format- Table -AutoSize Name, Status, Sideindicator, PSComputername