get-aduser using emailaddress
Solution 1:
It doesn't look like you are setting up properties for the search result to return. Ie:
Import-csv -Path \\tsclient\c\temp\test.csv -delimiter ";" | ForEach {
Get-ADUser -Filter "EmailAddress -eq '$($_.email)'" -Properties EmailAddress
}
Solution 2:
What kind of format are you getting this information in?
Personally, I like to make a temporary file then query using a variable in the for loop. For instance, if I had a file that was a list of email addresses at C:\Users\MyUser\Documents\emailList.txt
I would do the following:
$my_list = Get-Content C:\Users\MyUser\Documents\emailList.txt
foreach ($x in $my_list){
$x = $x replace '\s',''
Get-ADUser -Filter {EmailAddress -eq $x}
}
This will pull a Get-ADuser for the entire list by email address. It will also remove white space, which has caused me issues in this situation in the past. Let me know if you have further questions or if you have trouble getting the above commands to work.