Problem
You want to compare the output of two commands.
Solution
To compare the output of two commands, store the output of each command in variables, and then use the CompareObject cmdlet to compare those variables:
PS >notepad PS >$processes = GetProcess PS >StopProcess ProcessName Notepad PS >$newProcesses = GetProcess PS >CompareObject $processes $newProcesses
InputObject SideIndicator
System.Diagnostics.Process (notepad) <=
Discussion
The solution shows how to determine which processes have exited between the two calls to GetProcess. The SideIndicator of <= tells us that the process was present in the left collection ($processes) but not in the right ($newProcesses).
For more information about the CompareObject cmdlet, type GetHelp CompareObject.