PowerTip: Create a New User in Active Directory with PowerShell

PowerTip: Create a New User in Active Directory with PowerShell

  • Comments 9
  • Likes
Summary: Use the Active Directory module to create a user with Windows PowerShell.
 
Hey, Scripting Guy! Question How can I create a user in Active Directory with PowerShell?
Hey, Scripting Guy! Answer In Windows Server 2012 R2 or Windows Server 2008 R2, use the New-ADUser cmdlet.
 
To create a new user named “Doctor Scripto” in Active Directory:
 
NEW-ADUSER doctor.scripto –Givenname Doctor –Surname Scripto

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • New-ADUser Chendrayan -OtherAttributes @{title="SharePoint 2010 Admin";mail="something@domain.com"}

    Cool - PowerShell Rocks

  • how to start writing powershell scripts

  • Raj, 1. Open Notepad 2. Write 3. Save 4. Run 5. ????????? 6. PROFIT

  • What about the Password?

  • Raj, use the powershell ISE (included in .net framework). open start, type in "ISE" and you should get it. write a script and press F5 to run it.

  • Quick question..I have server 2012 (not R2). I tried this on my server, no luck. Is there a big difference between 2012 and 2012 R2? If so, how can I create new user in Powershell in 2012? I've tried everything I've read..thanks

  • thanks

  • Hi, please tell how to set the default password and password much change on next logon using the same script

  • to set the password use
    -AccountPassword (ConvertTo-SecureString "PASSWORD1" -AsPlainText -force)

    when the account is created it will be created as disabled, to enable as part of the creation
    -enabled $true

    -ChangePasswordAtLogon $true (I believe this is what you are looking for for change password at next logon)