COMMAND EVERYTHING.
Identify values present on only one side of two small in-memory lists.
PowerShell · Risk: Low · Documentation VerifiedLast verified: 2026-10-26
Returns unmatched values with side indicators. It does not modify either input list.
Compare-Object [-ReferenceObject] <PSObject[]> [-DifferenceObject] <PSObject[]>
[-SyncWindow <Int32>] [-Property <Object[]>] [-ExcludeDifferent] [-IncludeEqual]
[-PassThru] [-Culture <String>] [-CaseSensitive] [<CommonParameters>]Copied 0 timesNo elevation is required for the in-memory examples. Filesystem operations require read or traversal access to the selected path.
PowerShell · 7.6; filesystem examples require the FileSystem provider
-ReferenceObjectPowerShell 7.6 with Microsoft.PowerShell.Utility. For file examples, replace the sample path with an accessible file or directory.
Low risk for the supplied example. Protect file contents, paths, and returned system metadata. Review any modifications to the example before execution.
Compare-Object -ReferenceObject @('alpha','beta') -DifferenceObject @('beta','gamma')Returns unmatched values with side indicators. It does not modify either input list.
Sign in to keep your own command reference lists.
Explain or customize this command with AI