Powershell script to find unique values in two sets
- Sean O'Shea
- Mar 3, 2020
- 1 min read
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.