Well, that wasn't a cut and paste there. I just retyped the cmdlet in the mail message. The quotes in powershell are whatever it puts in when you type there...
Damien, Powershell 2.0 Servers are 2008R2 -Joe From: [email protected] [mailto:[email protected]] On Behalf Of Micheal Espinola Jr Sent: Thursday, October 17, 2013 1:58 PM To: [email protected] Subject: Re: [NTSysADM] RE: Powershell question Personally, the non-plaintext quotes in the OP bother me. -- Espi On Thu, Oct 17, 2013 at 1:22 PM, Damien Solodow <[email protected]<mailto:[email protected]>> wrote: 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<tel:317.447.6033> (office) 317.447.6014<tel:317.447.6014> (fax) HARRISON COLLEGE From: [email protected]<mailto:[email protected]> [mailto:[email protected]<mailto:[email protected]>] On Behalf Of Heaton, Joseph@Wildlife Sent: Thursday, October 17, 2013 4:12 PM To: [email protected]<mailto:[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<tel:%28916%29%20323-1284>

