Compare-Object - Powershell 1.0 CmdLet
Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.
More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.
Description Compare the properties of objects Usage Options -referenceObject PSObject Object(s) used as a reference for comparison. -differenceObject PSObject Object(s) to compare to the reference object(s). -syncWindow int Defines a search region where an attempt is made to re-sync the order if there is no match. -property Object Properties of the objects to compare. -caseSensitive Make comparisons case-sensitive. -culture string The culture to use for comparisons. -excludeDifferent Display only the characteristics of compared objects that are equal. -includeEqual Displays characteristics of compared objects that are equal. By default only differences are displayed. -passThru Pass the object created by this cmdlet through the pipeline. CommonParameters common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutVariable. Example(s) Compare the content of two text files: PS C:\>compare-object -referenceobject $(get-content C:\file1.txt) $(get-content C:\file2.txt) Compare the processes running before and after starting a copy of notepad.exe, using Get-Process to retrieve the processes running and store them in a variable: PS C:\>$proc_before = get-process notepad $proc_after = get-process compare-object -referenceobject $proc_before -differenceobject $proc_after