What version of Powershell are you running? What version are your DCs? That script works fine on my machine. :) I'm using PowerShell 3.0 on Windows 7 with 2008 R2 domain controllers.
You sure the CSV doesn't have blank lines or the like? DAMIEN SOLODOW Systems Engineer 317.447.6033 (office) 317.447.6014 (fax) HARRISON COLLEGE From: [email protected] [mailto:[email protected]] On Behalf Of Heaton, Joseph@Wildlife Sent: Thursday, October 17, 2013 4:12 PM To: [email protected] Subject: [NTSysADM] Powershell question 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

