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

Help Creating New AD User in Powershell from Existing User

$
0
0

So I do this: 

 

PS C:\Users\Administrator>$userinstance= Get-ADUser -Identity testuser

and make sure it's the right user by doing 

PS > $userinstance

Then, I try and create a new user based on that user in the same OU 

PS C:\Users\Administrator> New-ADUser -SamAccountName "garyooo" -name "garyo" -Instance $userinsance
New-ADUser : The password does not meet the length, complexity, or history requirement of the domain.
At line:1 char:11+ New-ADUser <<<< -SamAccountName "garyooo" -name "garyo" -Instance $userinsance+ CategoryInfo     : InvalidData: (CN=garyo,CN=Users,DC=gary,DC=local:String) [New-ADUser], ADPasswordComplex
  ityException+ FullyQualifiedErrorId : The password does not meet the length, complexity, or history requirement of the domain.
  ,Microsoft.ActiveDirectory.Management.Commands.NewADUser

ok, ok, so I do this: 

PS C:\Users\Administrator> New-ADUser -SamAccountName "garyoj" -Instance $userinsance -PasswordNotRequired $true

cmdlet New-ADUser at command pipeline position 1
Supply values for the following parameters:
Name:

Hmm, ok, it's asking for me for a name. ok. 

PS C:\Users\Administrator> New-ADUser -SamAccountName "garyoj" -name "garyoj" -Instance $userinstance -PasswordNotRequire
d $true
PS C:\Users\Administrator>

Oh goodie! It worked! 

....except the user isn't in the same container as $userinstance

 

WHy isn't the new user in the same OU as $userinstance? 


Viewing all articles
Browse latest Browse all 15028

Latest Images

Trending Articles



Latest Images

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