Create Bulk Organizational Units (OU) in Active Directory with PowerShell

In this guide, I’m going to show you how to create an organizational unit (OU) using PowerShell. I’ll give examples of creating a single OU and creating multiple OUs with PowerShell.

Maybe you are migrating to a new domain, or merging with another company, or creating a lab environment. Whatever the case PowerShell can be used to quickly create a bunch of OUs and save you time. 

Let’s get started. 

Create a Single Organizational Unit (OU) Using PowerShell

The New-ADOrganizationalUnit cmdlet creates an Active Directory organizational unit (OU). 

Here is an example:

The command below will create the OU “ADPRO Test Users” under the path DC=ad,DC=activedirectorypro,DC=com

New-ADOrganizationalUnit -Name "ADPRO Test Users" -Path "DC=ad,DC=activedirectorypro,DC=com"

Before I run the command here is a screenshot of Active Directory, you can see ADPRO Test Users do not exist. 

Now Open PowerShell and run the command. 

Refresh AD and the OU is now there. 

That was an example of creating a single OU with PowerShell. Now let’s look at how to create a bunch of OUs. 

Bulk Create Organizational Units (OU) using PowerShell

In this example, I’m going to create multiple OUs by using a CSV file.

Step 1: Create a CSV file with a name and path header. 

Step 2: Add the OU names under the name column and the path to where you want them created in AD. 

In the above screenshot, I’m going to create several OUs (Marketing, HR, IT, and so on) in the ADPro Test Users OU. 

The path is the distinguishedName of the OU. To find this go to the OU, right-click, select properties, then select the attribute editor. 

Step 3: Save the CSV

You can save it anywhere you want. 

Step 4:  Copy and Pase the script below into PowerShell ISE

# author:
# This script is used for creating bulk organizational units.

# Import active directory module for running AD cmdlets
Import-Module activedirectory

#Store the data from the CSV in the $ADOU variable. 
$ADOU = Import-csv C:\it\ou.csv

#Loop through each row containing user details in the CSV file
foreach ($ou in $ADou)
#Read data from each field in each row and assign the data to a variable as below

$name = $
$path = $ou.path

#Account will be created in the OU provided by the $OU variable read from the CSV file
New-ADOrganizationalUnit `
-Name $name `
-path $path `


Modify line #8 and update the path to your CSV. I called my CSV ou.csv and saved it to the c:\it folder so my line 7 looks like this. 

Step 5. Run the script

Click the “run script” button to run the script. 

Refresh AD and you should see the newly created OUs. 

Related: Create Active Directory Groups with PowerShell

How to View All Domain Organizational Units

The AD Pro Toolkit includes several built-in OU reports. Click on Reports -> OUs.

Click on a report and click run. In this example, I create a report on all the OUs created in the last 7 days. These reports are helpful in keeping track of your OUs and knowing what objects are in your domain.

The AD Pro Toolkit includes over 200 Active Directory Reports. You can download a free trial and try it on your own network.


In this guide, I showed you how to create a single OU and how to create bulk OUs by using the New-ADOrganizationalUnit cmdlet. I use this script to quickly rebuild my lab environment. I do a lot of testing in Active Directory so I often need to rebuild it from scratch to test new builds of the AD Pro Toolkit. This script helps to simplify the rebuild process of AD. 

Post your questions or comments below. 

Recommended: Active Directory Permissions Reporting Tool

Get instant visibility into user and group permissions in your Active Directory domain.

With Permissions Analyzer you can quickly view assigned and inherited permissions for any user or group.

Don't let permission problems slow you down or put your data at risk. Get Permissions Analyzer for Active Directory today and take control of your permission management.

Download Free Trial

2 thoughts on “Create Bulk Organizational Units (OU) in Active Directory with PowerShell”

Leave a Comment