Compare
Compare-Object
3 Important Parameters:
-ReferenceObject
The ReferenceObject is the baseline.
-DifferenceObject
The DifferenceObject is what you are looking for differences in.
-Property
This is the property of the object that you are comparing. Can be a comma-seperated list?
<=
Indicates that the property is present only on the ReferenceObject (Left Side).
=>
Indicates that the property is present only on the DifferenceObject (Right Side).
Compares two files and displays the differences using the File Compare command in CMD.
Compares the contents of two files or sets of files byte-by-byte, using the Comp command.
Compares two files and shows differences using PowerShell. This command reads each file's content and then compares the objects.
Checks if two files are identical, returning True or False, using PowerShell.
An alias in PowerShell for Compare-Object, used to compare file contents similar to the Unix/Linux diff
command.
Note: diff
as an alias may not be available in all PowerShell environments by default.
Example: Comparing two text Files
Example: Comparing the Process List of two computers:
Collect the baseline computer's process list:
Move it to the other computer to compare:
Last updated
Was this helpful?