This is the complete tutorial for creating bulk users in Active Directory.
Yes, I know
Creating Active Directory accounts is boring, it can be repetitive and time consuming when done manually. And who has the time to manually create bulk AD accounts?
Well, I’ve got good news!
Importing bulk ad users is simple and can actually be fun. (Yea I’m a nerd, automation is a great thing).
In this guide, I’ll show you step by step instructions on how easy it is to create bulk ad accounts.
I’m actually going to show you two methods to bulk import AD accounts.
Check it out
If you don’t like video tutorials or want more details, then continue reading the instructions below.
Method 1: Using PowerShell to import ad users from a csv
If you don’t like PowerShell or want a GUI import tool then jump to method 2.
What you will need:
- PowerShell Active Directory Module loaded – The script I provide will load the module you just need to run it from a computer that has RSAT tools installed or the AD role.
- Rights to create users accounts in Active Directory
- CSV file and PowerShell Script -> Download Here
Step 1: Setup the CSV file
There are only 5 fields in the CSV file that are required for each user account, they are:
I will walk through adding a few users to my csv file
Above is a screenshot of my csv file setup with the required fields configured. It’s not a good security practice to set the same password for every account, mix it up some.
I’ve set the PowerShell script to set the accounts to require password change at next logon, another good security practice. This can be changed if you want to remove that option.
You can set each account to import into a specific OU. I’ve set two accounts to import into the default users OU then I set one account to import into a Marketing OU.
How do you find the OU path?
The OU path is the distinguishedName attribute, to find this open up Active Directory Users and Computers and browse to the OU you want to import to, then right click and select properties then select attribute editor.
Copy the path into the OU column on the csv file.
At this point the csv file has the required fields, you can jump to step 2 (setting up the PowerShell script) or keep reading to setup optional fields for user accounts.
Setup User Optional fields
You may want to include some additional details for each account.
I’ve included some optional fields that are commonly used when setting up AD accounts. If there are fields you want to add that I have not provided, just add them to the CSV file (you will also need to add it to the script)
As you can see in the screenshot above I’ve entered info into the optional fields for 2 accounts.
Now save the CSV file to an easy to remember location. I’ve put mine in c:\it\Final_NewAccounts2.csv
The path of the CSV file will need to be entered into the powershell script. With the CSV file setup I’ll move to step 2.
Step 2: Setup the PowerShell script
The only thing that needs to be modified in the script is the path to the CSV file, and the UserPrincableName.
To modify the script just right click on the ps1 file and select edit. This will open the script in PowerShell ISE
Modify this section to the correct path of your CSV file.
$ADUsers = Import-csv C:\it\Final_NewAccounts2.csv
Now modify line 42 and change the domain
My domain is ad.activedirectorypro.com so I will update mine to
Save the changes and move on to step 3.
Step 3: Run the PowerShell Script to import the accounts
At this point, the CSV file should be setup with the users information and the Powershell script should be modified.
Now it’s time to execute the script.
In PowerShell ISE just click the green button to run the script.
It should return to the prompt if it ran successfully, I received a warning due to an account that already exists.
I will verify it created the other account.
Yes, it was a success.
That’s it for method 1. You can now use this script anytime to automate creating one or many AD user accounts. It’s a huge time saver.
Method 2: Using GUI Tool to bulk import AD users
This method requires no PowerShell. It’s super easy and has built-in support for many user attributes, adding to multiple groups, multiple proxyaddresses, and so on.
Step 2: Open AD Pro Toolkit and click on User Bulk Import
Step 3: CSV File Configuration
Click the Bulk Import button to generate a CSV template.
You will be prompted to save the CSV file. You can rename it if you want.
Now open the CSV template and fill out the fields you need.
- The only required field is the sAMAccountName, the rest are optional. This is a Microsoft required field.
- The template includes 33 user attributes. You can add additional attributes by adding a new column with the attribute name.
- Use the OU column to add users to an organizational unit. This needs to be the DN of the OU. I provided steps above for finding this value.
- You can add users to multiple groups by separating them with a comma. Example below in my CSV screenshot.
- You can give users multiple proxyaddresses just separate them with a comma.
In this example, I’m going to create several users, import them into the Marketing OU, and add them to multiple security groups. Here is a screenshot of my CSV file.
When you have your CSV template ready just save it and move to step 3.
Step 3. Select CSV and click run
The next step is to select the template from the GUI tool and click run.
You will see the progress in the lower left.
When the import is complete click the logs button to check for any errors.
The log screen is a great feature so you can double check the import had no errors. You can use the search button to filter for any error events.
Next, I’ll open an account and verified all properties were set.
Yes! It worked, it created the account and imported all the fields I set.
I’ll check the Marketing folder to verify the accounts imported into the correct OU.
The GUI tool makes the bulk importing process very easy, no coding or PowerShell experience is needed. The AD Pro Toolkit also includes a tool for bulk updating user accounts. This is a huge time saver for when you need to mass update user information such as department, telephone number, email addresses, and so on.
I have shown you two methods for creating bulk users in Active Directory, try them out and decide which one works best for you.