Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

AD User Creation Error

$
0
0

Hey guys! I've been working on a little project recently and I had a little error, the project is simple, a little program to create users in active directory by clicking on a button. I used that sentence for the creation:

#############################################################################

 

New-ADUser -Name "$username" -AccountExpirationDate "4/10/2016" -AccountNotDelegated $false -AccountPassword (Read-Host -AsSecureString "Give the generated password") -AllowReversiblePasswordEncryption $false -AuthType Negotiate -CannotChangePassword $false -Certificates $null -ChangePasswordAtLogon $false -City "" -Company "" -Country "" -Credential Administrator -Department "" -Description "" -DisplayName "" -Division "" -EmailAddress "" -EmployeeID "" -EmployeeNumber "" -Enabled $true  -Fax "" -GivenName ""  -HomeDirectory "P:\Dossiers Personnels\$username" -HomeDrive "P:" -HomePage "http://google.ch" -HomePhone "" -Initials "" -Instance "" -LogonWorkstations "" -Manager Administrator -MobilePhone "" -Office "" -OfficePhone "" -Organization "" -OtherAttributes @{title="user"} -OtherName "" -PassThru  -PasswordNeverExpires $true -PasswordNotRequired $false -Path "ou=Users,dc=WIN-VENUOMRLOOG" -POBox "25662" -PostalCode "" -ProfilePath "C:\Users\" -SamAccountName "$username" -ScriptPath "" -Server MyName -ServicePrincipalNames "" -SmartcardLogonRequired $false -State "" -StreetAddress "" -Surname "" -Title "" -TrustedForDelegation $false -Type "" -UserPrincipalName"" -Confirm

#############################################################################

Basically, I just wanna create the simplest user possible, but I get the error:

New-ADUser : The server is unwilling to process the request
At C:\Users\Administrator\Documents\Myproject.ps1:47 char:2
+  New-ADUser -Name "$username" -AccountExpirationDate "4/10/2016" -AccountNotDele ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (CN=b.a,ou=Users,dc=WIN-VENUOMRLOOG:String) [New-ADUser], ADException
    + FullyQualifiedErrorId : ActiveDirectoryServer:0,Microsoft.ActiveDirectory.Management.Commands.NewADUser

Can you guys help me please? Thanks already.



Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

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