Hi, I have a csv file with a email address and the employ ID. I which to update the emply id according to the email address
csv:
Email;employerID;FirstName;LastName;
a.a@test.com;123456789;a;a;
b.b@test.com;789456123;b;b;
I tried querying the user according to email but the user is not found:
$test = Import-csv -Path \\tsclient\c\temp\test.csv -delimiter ";" Foreach ($u in $test) {Get-aduser -Filter { emailaddress -Like $u.email} -Properties emailaddress}
Which i find strange, because when i run following commandlet the correct address are displayed.
$test = Import-csv -Path \\tsclient\c\temp\test.csv -delimiter ";" Foreach ($u in $test) {write-host $u.email}
I even tried, but same result:
$test = Import-csv -Path \\tsclient\c\temp\test.csv -delimiter ";" Foreach ($u in $test) {Get-aduser -Filter { emailaddress -Like $($u.email)} -Properties emailaddress}
What am i doing wrong?