Anonymous
Creating users with Powershell on Windows Server 2008 R2, not able to Enable-ADAccount in one command
0
PEOPLE
I am trying to add a list of users to my Windows Server 2008 R2 domain. Below is my test command. Everything works, except that the account does not get enabled. The account gets created, the password gets set but the account stays disabled with this command. I can run this command and then do an Enable-ADAccount 'bob' and the account will activate.
new-aduser -SamAccountName bob -Name 'bob' -PassThru |Set-ADAccountPassword -reset -NewPassword (ConvertTo-SecureString -asplaintext 'Newpass#2' -force) -PassThru | Enable-ADAccount
I have tried different things but can't get the account to enable on the one command line.
Thanks
Replies
Try reversing the order of Set-ADAccountPassword and -EnableADAccount. Does that help?
No. I get the error that the password does not meet the length, complexity or histiory requirement on the domain error if I do the enable-adaccount first.







