This is the complete tutorial to 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, you can decide which one works best for you.
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:
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
What you will need
- SolarWinds Bulk import tool -> FREE Download here
- csv file -> Download here
- Rights to create users accounts in Active Directory
Step 1: Download and Install the GUI import tool
The install is very simple:
1. Extract the downloaded zip file and run the UserImportTool.msi
2. Click next
3. Accept agreement then click next
4. Choose destination path (default is fine) click next
5. Click install
6. Click Finish
Install finished and I know have the tool opened ready to configure.
Step 2. SolarWinds Bulk import CSV File setup
Before I configure the bulk import tool I need to setup the csv file.
The csv file column headings need to match the fields in the bulk import tool. If they don’t match it will not import those fields.
To find the right fields you can use the attribute editor in Active Directory Users and computers.
To save you time, below is a list of some common fields and what they map to in Active Directory Users and computers. These are what I’ve included in the csv file, you can remove or add more.
- Sam-Account-Name = logon name
- Password = Password
- Give-Name = First Name
- Initials = Initials
- Display-Name = Display name:
- Surname = Last Name
- Postal-Code = Zipcode
- Department = Department
- Company = Company
- E-mail-Addresses = E-mail
- Street-Address = Street
- Telephone-Number = Telephone number
- Title = Job Title
- State-Or-Province-Name = State
- Country-Name = County
The first two columns of the csv are required everything else is optional. If you don’t specify an organizational unit it will use the default OU.
Here is a screenshot of my csv file setup for two accounts.
Now that the csv is setup, I’ll move to step 2.
Step 2: Configure Import tool settings
There are not a lot of settings, basically it’s just the credentials to active directory then select the csv file.
I’ve tested my credentials and everything looks good.
Step 3: Map Custom Fields
On the Map Custom Fields screen I need to add all the fields from my csv that I want to import.
Below is a screenshot of the default fields that are configured
To add more fields just use the search box in the lower left or the drop down menu.
This is what it looks like after I’ve added the fields I want to import.
With everything mapped, I’ll click next
Important: Save your mapping by clicking on save mapping. If you don’t do this you will need to re-create your mapping each time you open up the bulk import tool.
Now I get a preview so I can verify the mappings are correct.
Everything looks correct so I will click the create button.
I get a warning that some of the fields are empty. I’ll need to go back and update the spreadsheet to include the initials and country-name for that user.
Important: What I found out is whatever fields you setup in the mapping need to be filled out in the CSV file or else the bulk import tool will throw up a warning.
No problem, I’ll just update my csv file.
With all the fields filled out I have successfully imported the accounts.
I’ll go into Active Directory users and computer and verify this.
It worked, it created the account and imported all the fields I set.
I have shown you two methods for creating bulk users in Active Directory, try them both and decide which one works best for you.
Recommended Tool: SolarWinds Server & Application Monitor (SAM)
This utility was designed to Monitor Active Directory and other critical applications. It will quickly spot domain controller issues, prevent replication failures, track failed logon attempts and much more.
What I like best about SAM is it’s easy to use dashboard and alerting features. It also has the ability to monitor virtual machines and storage.