I'm hoping this is a simple question.
I have a csv with a list of 1200 or so user names. I want to import that into
powershell, and for each one, query AD for that user's mail attribute. I then
want to export to a new csv, the username and the mail attribute.
I thought it would be fairly simple and this is what I tried:
Import-csv "c:\scripts\user list.csv" | foreach {get-ADuser -Identity $_.Name
-Property *} | select sAMAccountname,mail | export-csv
c:\scripts\reports\usermail.csv -NoTypeInformation
This is the error I get:
Get-ADUser : Cannot convert 'System.Object[]' to the type
'Microsoft.ActiveDirectory.Management.ADUser' required by parameter 'Identity'.
Specified method is not supported.
The csv I'm importing has one column, titled Name, with sAMAccountnames under
it.
Thanks,
Joe Heaton
Enterprise Server Support
CA Department of Fish and Wildlife
1807 13th Street, Suite 201
Sacramento, CA 95811
Desk: (916) 323-1284