Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

New-ADUser with Import-Csv...

$
0
0

trying to run this cmd from an elevated PS prompt.

Import-CSV "C:\Users\administrator\Documents\Students.csv" | foreach {New-ADUser -SamAccountName $_.PermID -Name ($_.FirstName + " " + $_.LastName) -DisplayName ($_.FirstName + " " + $_.LastName) -Surname $_.LastName -GivenName $_.FirstName -Path $_.OU -AccountPassword (ConvertTo-SecureString -AsPlainText $_.Password -Force) -Enabled $true }

and it fails with

New-ADUser : The server is unwilling to process the request
At line:1 char:81
+ Import-CSV "C:\Users\administrator\Documents\Students.csv" | foreach {New-ADUser <<<<  -SamAccountName $_.PermID -Nam
e ($_.LastName + ", " + $_.FirstName) -DisplayName ($_.LastName + ", " + $_.FirstName) -Surname $_.LastName -GivenName
$_.FirstName -Path $_.OU -AccountPassword (ConvertTo-SecureString -AsPlainText $_.Password -Force) -Enabled $true }
    + CategoryInfo          : NotSpecified: (CN=Marsh\, Stan...dents,dc=testad:String) [New-ADUser], ADException
    + FullyQualifiedErrorId : The server is unwilling to process the request,Microsoft.ActiveDirectory.Management.Comm
   ands.NewADUser

No really sure what it means by the server is unwilling. Could it be the Account/Password Policies?

Thanks for the help


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>