Share via


Error with New-ADUser command.

Question

Tuesday, April 30, 2013 4:18 PM

Hello everyone,  just starting with powershell and must create a a few hundred users.  managed to write something like code below  but it generates error below.  any help is appreciated.

New-ADUser : The server is unwilling to process the request
At C:\scripts\MTLtestlabecreatenewuser-in-ou.ps1:17 char:13

  •      New-ADUser <<<<  @user
        + CategoryInfo          : NotSpecified: (CN=Jane Smith,o....PRIVATE,dc=COM:String) [New-ADUser], ADException
        + FullyQualifiedErrorId : The server is unwilling to process the request,Microsoft.ActiveDirectory.Management.Comm
       ands.NewADUser   

=====

Import-Module ActiveDirectory
Import-CSV C:\Scripts\createnewusercsv.csv | ForEach {
$user = @{
name=$_.name
displayname=$_.displayname
givenname=$_.givenname
surname=$_.surname
samaccountname=$_.samaccountname
userprincipalname=$_.userprincipalname
#emailaddress=$_.emailaddress
#homedirectory=$_.homedirectory
accountpassword=(ConvertTo-SecureString "ACDL123" -AsPlainText -Force)
Path = "ou=steve-test,dc=NHSEXCHANGELAB.PRIVATE,dc=COM"
server = "2k07ADC01"
};#@

  New-ADUser @user 

} #foreach

=====

All replies (3)

Tuesday, April 30, 2013 4:50 PM âś…Answered | 3 votes

I am not at a machine where I can test this but usually the error "Unwilling to process the request" signifies you have a DN wrong.   Check the following line and make sure your path is correct.

Path = "ou=steve-test,dc=NHSEXCHANGELAB.PRIVATE,dc=COM"

Probably something more like ou="someOU, dc=NHSExchangeLab, dc = Private, dc=com"


Tuesday, April 30, 2013 4:57 PM

Bingo.

That was the issue.    Many thanks.


Friday, May 3, 2013 5:23 AM

Hi,

I would like to mark willing's reply as answer, if there is anything else we could do for you, please feel free let us know.

Regards,

Yan Li

If you have any feedback on our support, please click here .

Cataleya Li
TechNet Community Support