Author Posts

September 9, 2016 at 11:31 pm

I have imported a few properties of an ADUser I want to create from a csv

DisplayName         : JT_vNext
mail                :
mailnickname        : Ha5tv9x
ProxyAddresses      :
targetaddress       :
extensionAttribute5 : MBX=25GB;TYPE=EP2D_Dumpster;

and have tried to pipe this into this bit of PS to create the user(s):

$newUsers |
     % {New-ADUser  -Credential $creds -Path 'OU=vNext,DC=amer,DC=co,DC=com'-Name $_.DisplayName -samAccountName $_.mailnickname -DisplayName $_.DisplayName -EmailAddress $_.mail `
      -OtherAttributes @{ProxyAddresses="$_.ProxyAddresses";mailnickname="$_.mailnickname";targetAddress="$_.targetaddress";extensionAttribute5="$_.extensionAttribute5"}`
       } # -Enabled $True -AccountPassword (ConvertTo-SecureString $_.Password -AsPlainText -force) -PasswordNeverExpires $True}

Error returned is:

New-ADUser : A value for the attribute was not in the acceptable range of values
At line:2 char:9

I have commented out the -Enabled True section until I can at least get some users in AD working first. NOt sure what attribute PS is balking at.


September 9, 2016 at 11:51 pm

Remove the quotes around the piped object properties, as when in quotes Powershell hasn't been given a chance to evaluate what $_.ProxyAddresses is yet.

So change:




And repeat the process for each property you have there.

If you want it in quotes, you can force evaluation by wrapping it in brackets and pre-pending a dollar sign:

  • This reply was modified 2 years ago by  84rusty ..

September 10, 2016 at 2:13 am

Thank you Rusty....I have Users now.