i Have 2 CSV\'s
left.csv
Ref_ID,First_Name,Last_Name,DOB
321364060,User1,Micah,11/01/1969
946497594,User2,Acker,05/28/1960
887327716,User3,Aco,06/26/1950
$left = Import-Csv C:\left.csv
$right = Import-Csv C:\right.csv
Compare-Object -ReferenceObject $left -DifferenceObject $right -Property First_Name,Last_Name,DOB -IncludeEqual -ExcludeDifferent |
ForEach-Object {
$iItem = $_
$ileft = $left.Where({$_.First_Name -eq $iItem.First_Name -and $_.Last_Name -eq $iItem.Last_Name -and$_.DOB -eq $iItem.DOB})
$iright = $right.Where({$_.First_Name -eq $iItem.First_Name -and $_.Last_Name -eq $iItem.Last_Name -and$_.DOB -eq $iItem.DOB})
[pscustomobject]@{
Ref_ID=$ileft.Ref_ID
first_name=$ileft.first_name
last_name=$ileft.last_name
DOB=$ileft.DOB
Document_Type=$iright.Document_Type
Filename=$iright.Filename
}
} | Export-Csv C:\Combined.csv -NoTypeInformation