PEBKAC.

damien.solodow



-------- Original message --------
From: "Heaton, Joseph@Wildlife" <[email protected]>
Date: 10/17/2013 6:39 PM (GMT-05:00)
To: [email protected]
Subject: RE: [NTSysADM] RE: Powershell question


Thanks guys, I must have fat fingered something initially.  It worked fine now.

Joe


> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Damien Solodow
> Sent: Thursday, October 17, 2013 2:38 PM
> To: [email protected]
> Subject: RE: [NTSysADM] RE: Powershell question
>
> Yep; works with v2 on my system as well.
>
> I'd be inclined to look at your csv file; make sure it's a good CSV and 
> doesn't
> have any null lines.
>
> DAMIEN SOLODOW
> Systems Engineer
> 317.447.6033 (office)
> 317.447.6014 (fax)
> HARRISON COLLEGE
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Don Kuhlman
> Sent: Thursday, October 17, 2013 5:32 PM
> To: [email protected]
> Subject: RE: [NTSysADM] RE: Powershell question
>
> I did the same thing using a test csv file - it worked with Powershell v2 on
> Server 2008 R2 SP1.
> When Posh did the autocomplete for me it put in "Properties" but "Property"
> worked too.
>
> My csv file was like this:
> samaccountname
> usera
> userb
>
>
> import-csv "c:\scripts\user list.csv"  |foreach {Get-ADUser -identity
> $_.samaccountname -Properties *} | select samaccountname,mail | export-
> csv c:\scripts\reports\usermail.csv -NoTypeInformation
>
>
> Don K
>
> --------------------------------------------
> On Thu, 10/17/13, Heaton, Joseph@Wildlife
> <[email protected]> wrote:
>
>  Subject: RE: [NTSysADM] RE: Powershell question
>  To: "[email protected]" <[email protected]>
>  Date: Thursday, October 17, 2013, 4:23 PM
>
>
>
>
>
>
>
>
>
>  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]>
>  wrote:
>
>
>  What version of Powershell are you
>  running?
>  What version are your DCs?
>
>
>  That script works fine on my machine.
>  J
>  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
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


Reply via email to