Question:
when i want to get some information from an user i use this:
1 2 |
Get-ADUser -Filter {EmailAddress -eq 'jperez@dominio.com'} |
but when i wanna check the information from a bulk of users i try this:
1 2 |
$batch| foreach {Get-ADUser -Filter {emailaddress -eq $_.email}} |
email is the name of the variable in the CSV file
but i am getting this error:
“Get-ADUser : Property: ’email’ not found in object of type: ‘System.Management.Automation.PSCustomObject'”
i can not use the identity because te emailaddess is not supported for this one
Answer:
It doesn’t look like you are setting up properties for the search result to return. Ie:
1 2 3 4 |
Import-csv -Path \\tsclient\c\temp\test.csv -delimiter ";" | ForEach { Get-ADUser -Filter "EmailAddress -eq '$($_.email)'" -Properties EmailAddress } |