Quantcast
Viewing all articles
Browse latest Browse all 21975

Error with New-ADUser command.

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

=====


Viewing all articles
Browse latest Browse all 21975

Trending Articles