top of page

Powershell script to find unique values in two sets

You can use a simple PowerShell script to find which values in two sets are unique to each set.

Define each set of comma separated values: $set1 = "chicago","boston","baltimore"

$set2 = "detroit","boston","philadelphia"

Then use the Compare-Object command to analyze the sets:

Compare-Object $set1 $set2

PowerShell will generate a list showing just those values that are not in both sets.

bottom of page