PowerTip: Create an Organizational Unit with PowerShell

PowerTip: Create an Organizational Unit with PowerShell

  • Comments 5
  • Likes

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”

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Very Useful cmdlet

  • @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.

    Sean

  • 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.

    Using:

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

  • 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

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