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.
1 2 3 |
$before = (Get-Process).ProcessName Start-Process -FilePath calc.exe $after = (Get-Process).ProcessName |
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 -ReferenceObject $before -DifferenceObject $after -IncludeEqual