# New-ADUser -otherAttributes (acceptable range of values ERROR)

**URL:** <https://forums.powershell.org/t/new-aduser-otherattributes-acceptable-range-of-values-error/7174>\
**Category:** PowerShell Help\
**Created:** [September 9, 2016, 6:01pm UTC](https://forums.powershell.org/t/new-aduser-otherattributes-acceptable-range-of-values-error/7174 "2016-09-09T18:01:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeff-taylor](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/jeff-taylor/32/1015_2.png) [@jeff-taylor](https://forums.powershell.org/u/jeff-taylor)\
**Post date:** [September 9, 2016, 6:01pm UTC](https://forums.powershell.org/t/new-aduser-otherattributes-acceptable-range-of-values-error/7174/1 "2016-09-09T18:01:23Z")

</div>

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

```
DisplayName : JT_vNext
mail : JT_vNext@co.com
mailnickname : Ha5tv9x
ProxyAddresses : SMTP:J_T_vNext@co.com
targetaddress : smtp:Ha5tv9x@mgd.co.com
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.

Thanks

---

<div class="post-metadata">

**Author:** ![84rusty](https://avatars.discourse-cdn.com/v4/letter/8/ac8455/32.png) [@84rusty](https://forums.powershell.org/u/84rusty)\
**Post date:** [September 9, 2016, 6:21pm UTC](https://forums.powershell.org/t/new-aduser-otherattributes-acceptable-range-of-values-error/7174/2 "2016-09-09T18:21:17Z")

</div>

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:

```
ProxyAddresses="$_.ProxyAddresses"
```

To:

```
ProxyAddresses=$_.ProxyAddresses
```

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:

```
ProxyAddresses="$($_.ProxyAddresses)"
```

---

<div class="post-metadata">

**Author:** ![jeff-taylor](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/jeff-taylor/32/1015_2.png) [@jeff-taylor](https://forums.powershell.org/u/jeff-taylor)\
**Post date:** [September 9, 2016, 8:43pm UTC](https://forums.powershell.org/t/new-aduser-otherattributes-acceptable-range-of-values-error/7174/3 "2016-09-09T20:43:19Z")

</div>

Thank you Rusty…I have Users now.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:40pm UTC](https://forums.powershell.org/t/new-aduser-otherattributes-acceptable-range-of-values-error/7174/4 "2024-05-16T20:40:22Z")

</div>


