So I have two csv files from different sources. They each have an employee id column csv1 has "employeeid" column with employeeid numbers csv2 has "employeeid" column with no employeeid numbers
both files also have emailaddress field
I want to match the emailaddresses between both csv files and then give me an output of emailaddresses matched column and a column showing what employeeid from csv1 corresponds with the emailaddress match
does that make sense?
Here is what i have so far and it seems kind of janky and i confused myself lol
$Path = C:\Powershell
$userhr = import-csv -path C:\userhr.csv
$userdata = import-csv -path c:\userdata.csv
$useroutput = @()
For Each ($name in $userhr)
{
$usermatch = $userdata | where {_$.Username -eq $name.usernames}
if ($usermatch)
{
$useroutput += New-Object PsObject -Property @{Username =$name.usernames,employeeid=
$usermatch.employeeid.employeeid =$usermatch.employeeid}
{
else {
$useroutput += new-object Psobject -property @{username$name.usernames;employeeid"NA";employeeid="NA"}
$useroutput | export-csv c:\outfile.csv
i kinda hashed together some of my knowledge and some of what i found online
but kinda wanna start fresh and see how others would solve this issue