Powershell Tip #49: Compare two sets of objects

By | October 6, 2015

Tip: You want to compare two sets of objects.

For example, you want to take a “snapshot” from your running processes and check after a while the difference (based on another “snapshot”).

You could use the same logicial to compare processes on two different computers for example.

ReferenceObject : the “source”, the reference object you will use to compare

DifferenceObject : the object you will compare to the reference object.

Compare-Object -ReferenceObject $before -DifferenceObject $after

compare-object-calc-powershell

Compare-Object -ReferenceObject $before -DifferenceObject $after -IncludeEqual

compare-object-calc-powershell-includeequal


previous-buttonnext-button

One thought on “Powershell Tip #49: Compare two sets of objects

  1. Pingback: Powershell Tip #50: Difference between Write-Error and throw | Powershell Guru

Leave a Reply

Your email address will not be published. Required fields are marked *