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
CompareFile.csv
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 *