I have 2 CSV's. One is a list of accounts ($filename2), and the other is a list of accounts I don't want to be in the first list ($excludelist).
I am trying to use compare-object to just grab the unique values from the first list, however I have noticed some of the values in the second list are there as well. Can someone please take a look at this section of code and help me figure out where I went wrong?
$filename3 = "FinalDoc"
$excludelist = "ExcludeList"
$exclude = import-csv $excludelist
$include = import-csv $filename2
Compare-Object $exclude $include -property UserPrincipalName,ObjectId | where-object {$_.SideIndicator -like "=>"} | export-csv $filename3