Comparing two specific properties of a CSV using Compare-Object isn't giving the expected results
- by MDMarra
I have a list of users from two separate domains. These lists are in CSV format and I only care about the SAMAccountName, which is a field in these CSVs.
The code that I'm working with is currently:
$domain1 = Import-CSV C:\Scripts\Temp\domain1.xxx.org.csv | Select-Object SAMAccountName
$domain2 = Import-CSV C:\Scripts\Temp\domain2.xxx.org.csv | Select-Object SAMAccountName
Compare-Object ($domain1) ($domain2)
This is returning only a handful of results (which aren't accurate) in this format:
@{samaccountname=SomeUser} =>
Obviously, Compare-Object isn't evaluating the objects as strings. How do I make this work?