Skip to content
ConsoleMonster
Cmdlet

Compare-ConsoleObject

Module ConsoleMonster
Inputs
System.Object[]
Outputs
ConsoleMonster.Changes.ObjectChange

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>]
#
Parameter set: All Parameter Sets

Description

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

Authored help example

EXAMPLE 1

Compare-ConsoleObject -ReferenceObject @('Value') -DifferenceObject @('Value')

Parameters

-CompareProperty String[] optional
The properties to compare (default all).
-Depth Int32 optional
How deep nested objects are compared (default 3).
-DifferenceObject Object[] requiredposition: 1pipeline: True (ByValue)
The new objects.
-Ignore String[] optional
Properties or paths (Address.City, wildcards) left out of the comparison.
-IncludeEqual SwitchParameter optional
Lists unchanged objects too.
-PassThru SwitchParameter optional
Returns the changes as objects instead of showing them.
-Property String[] optional
The properties that identify an object (matching key). Default: Id, Key, Name and similar members.
-ReferenceObject Object[] requiredposition: 0
The old objects.
-Title Object optional
A title (markup).
-View ChangeViewMode optional
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.