I'm trying to figure out the best way to accomplish this task. Any guidance is much appreciated!
I have 2 CSV files. The 1st file has 2 columns (Computer & Email). The 2nd file has 1 column (Email). I need to compare both files based on the Email column and return the matches. The output should included the Email and Computer columns.
MasterFile.csv
Computer | |
---|---|
Computer1 | userA@company.com |
Computer2 | userB@company.com |
Computer3 | userC@company.com |
Computer4 | userA@company.com |
CompareFile.csv
userA@company.com |
userC@company.com |
My code thus far:
$MasterCSV = Import-Csv -Path C:\MasterFile.csv $CompareCSV = Import-Csv -Path C:\CompareFile.csv Compare-Object -ReferenceObject $MasterCSV.Email -DifferenceObject $CompareCSV.Email -IncludeEqual -ExcludeDifferent | Select *