OK,
Let's take this a step further.
I have two CSV files with a header line on each.
The CSV would look something like this:
Name,Email
Mickey Mouse,mmouse@disney.com
Donald Duck,dduck@disney.com
I need to compare the two CSV's. The output needs to retain the header information so I can pass it to another command.
Code:
compare-object (gc list1.csv) (gc list2.csv) | %{if ($_.SideIndicator -eq "<=") {new-mailcontact -ExternalEmailAddress "SMTP:$($_.InputObject)" -Name "$($_.InputObject)"}}
The above does the trick but I would like to add the name field with the proper name and not the email address.
Thank you PowerShell wizards!