PowerTip: Create an Organizational Unit with PowerShell

Summary: Use Windows PowerShell to create an organizational unit in Active Directory.

Hey, Scripting Guy! Question How can I use Windows PowerShell to create an OU in my Active Directory?

Hey, Scripting Guy! Answer In Windows Server 2012 R2 or Windows Server 2008 R2, use the New-ADOrganizationalUnit cmdlet.

To create a new OU at the root of Active Directory called “Divisions”:

NEW-ADOrganizationalUnit “Divisions”

If it needs to exist in different path in Active Directory, specify the path by its distinguished name:

NEW-ADOrganizationalUnit “Divisions” –path “OU=Offices,DC=Contoso,DC=local”

Comments (6)

  1. @chen v

    Yes.  It's a far cry than trying to do it with Vbscript.  

    I love the fact that PowerShell offers a common and simple methodology regardless of whether I am working with Exchange in Office 365 or managing files on the local drive.


  2. Marcel K says:

    Any tips on using the dsacls to set and remove inherited permissions.

    I want to remove the inheritance mark, but keep the security, but if I remove the inheritance by pwoershell the security is removed and not kept.


    dsacls “\$varDcOU=$varOrg,$varBase” /G “CN=$varOrg Group,OU=Groups,OU=$varOrg,$varBase:RCLCRP” /I:P

  3. Steve says:

    How would you pass a list of OU’s to New-adorganisationalunit?
    I’m thinking of using a csv and listing the names and the ou path.

    Thanks in anticipation

  4. gomzi says:

    how to add a user in organization under some organization??
    Example: Staff OU Which has HR as a OU inside it

  5. Bones says:

    I have a CS file that contains the names of 104 new employees at Contoso…how can I script PowerShell…to import the file and create each batch of users….using an Organizational Units…

Skip to main content