PowerShell: How to Create an AD User in a Specific OU

You can create an AD user in a specific OU by using the -path parameter in New-ADuser. The following example will create a user in the students OU of the pel.com domain.

New-ADUser -Name “Karim Buzdar" -GivenName Karim -Surname Buzdar -SamAccountName kbuzdar -UserPrincipalName [email protected] -path "OU=students, DC=pel, DC=com

5 thoughts on “PowerShell: How to Create an AD User in a Specific OU”

  1. Thanks from your notes, but i have one question if we have a nesting OU so how we can add user in nested OU using powershell.

    Ex: NewYork (Main OU) and there is another OU inside NewYork(Users)
    so how we can add user in Users (OU) suing Powershell.


  2. Simply put the distinguished name of NewYork’s user OU as the path

    -path “OU=Users , DC=NewYork, DC=MyCompany, DC=com”

  3. Create a POWERSHELL SCRIPT for creating users “Followers” and “Violators” under OU “Lockdown”
    NOTE: The user and OU details have to be passed via an excel object.

    • There are no spaces in the path, so it would be “OU=Users,DC=NewYork,DC=MyCompany,DC=com”. Also, I’d be willing to bet it should be “OU=NewYork”, unless your domain is NewYork.MyCompany.com.


Leave a Comment