Compare-ConsoleObject
Compares two sets of objects and shows what was added, removed and changed, property by property.
Syntax
Compare-ConsoleObject [-CompareProperty <String[]>] [-Depth <Int32>] [-DifferenceObject] <Object[]> [-Ignore <String[]>] [-IncludeEqual] [-PassThru] [-Property <String[]>] [-ReferenceObject] <Object[]> [-Title <Object>] [-View <Full|Summary|Table|SideBySide|Unified>] [<CommonParameters>]#All Parameter SetsDescription
Compares two sets of objects and shows what was added, removed and changed, property by property.
Like Compare-Object, with a much better display: objects are matched by -Property (or by Id, Name, Key and similar members), then compared property by property, nested objects by path. The view shows the counts by kind and a table of the changes in the design-system tones (added in green, removed in red, changed in yellow), with line diffs of long and multi-line values; -View picks Summary, Table, SideBySide or Unified. -PassThru returns the structured changes (ConsoleMonster.Changes.ObjectChange) instead.
Examples
EXAMPLE 1
Compare-ConsoleObject -ReferenceObject @('Value') -DifferenceObject @('Value')Parameters
- -CompareProperty String[]
- The properties to compare (default all).
- -Depth Int32
- How deep nested objects are compared (default 3).
- -DifferenceObject Object[]
- The new objects.
- -Ignore String[]
- Properties or paths (Address.City, wildcards) left out of the comparison.
- -IncludeEqual SwitchParameter
- Lists unchanged objects too.
- -PassThru SwitchParameter
- Returns the changes as objects instead of showing them.
- -Property String[]
- The properties that identify an object (matching key). Default: Id, Key, Name and similar members.
- -ReferenceObject Object[]
- The old objects.
- -Title Object
- A title (markup).
- -View ChangeViewMode
- The view: Full (default), Summary, Table, SideBySide or Unified.
- Possible values:
Full,Summary,Table,SideBySide,Unified
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.