Create Bulk Users in Active Directory (Step-By-Step Guide)

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

Video Tutorial

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:

firstname
lastname
username
password
ou

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)

email
streetaddress
city
zipcode
state
county
department
telephone
job title
company

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

-UserPrincipalName "$Username@winadpro.com"

My domain is ad.activedirectorypro.com so I will update mine to

-UserPrincipalName "$Username@ad.activedirectorypro.com"

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

Step 1: Download and Install the GUI import tool

Download FREE tool here

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.

Related: Top 5 AD Bulk import tools

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.

Download Your Free Trial of SolarWinds Server & Application Monitor. 

18 Comments

  1. Nick on March 15, 2018 at 10:42 am

    I been looking for a script that works is there a reason why you didnt add the description and office fields?

    • Robert Allen on March 15, 2018 at 11:45 pm

      Hi Nick,

      The description and office fields are not something I commonly used when creating bulk users. The script can easily be modified to include any fields you want, just add the field to the excel file and include it in the script.

  2. KB on May 1, 2018 at 7:05 pm

    Thank you for this! This works like a charm!

    • Robert Allen on May 1, 2018 at 11:50 pm

      You’re welcome. Glad it worked.

  3. Gideon on May 21, 2018 at 9:59 am

    This is amazing, I tweaked it to suit my requirements and it worked like the name of Jesus!
    Thank you!

    • Robert Allen on May 22, 2018 at 12:36 am

      Gideon, glad it worked.

  4. SHarbel on May 31, 2018 at 5:32 am

    This is excellent!
    Do you know if there is a way to import a user without setting a new pw?

    • Robert Allen on May 31, 2018 at 10:26 am

      Sharbel, Having user accounts with no passwords is a big security risk. I would not recommend it.

      With that said I think you can use this command New-ADUser “John Doe”. This will create the account but will disable it until a password is provided.

  5. Javier on June 11, 2018 at 7:47 pm

    Hello, Robert,
    The manual that you publish is perfect for now that I use WS2016.

    Thanks for sharing.

  6. John Herry on June 18, 2018 at 10:13 am

    thank, it’s excellent !!

    • Robert Allen on June 20, 2018 at 12:00 pm

      You’re welcome.

  7. PM on August 7, 2018 at 4:21 pm

    I figured out my issue. Thanks for this script it was great!

  8. Fernando on September 22, 2018 at 9:01 pm

    Hi Robert! Thank you so much for this approach. I took your example and I’ve modified the logic for the following reasons.
    Suppose you’re managing a multi-domain AD environment (same forest) and HR department send you the list of new hires for the entire company each month. If you don’t have a software managed solution (which is my case) you have to manage the process by your own.

    So, in the CSV file I’ve added the following columns:
    – UPNSuffix
    – UPN (which is a formula — =TEXTJOIN(,TRUE,A2,”@”,H2) where A2 contains Name/SamAccountName property and H2 contains UPNSuffix string) As a result you have SamAccountName@UPNSuffix.
    – MobilePhone (value required for sales users)
    – OU (this is for creating accounts into different OUs)

    The main change in the script logic is based on “what if HR send you a list in which a given SamAccountName is already created for a user account, but the lastname of the user has changed (let’s say… a woman got married)?. According to the validation you’re doing, the script will throw a warning and it’ll skip the creation when in fact the account must be modified.

    Let’s take into account the fact that modifications are required as creations as well. So… instead of using New-ADUser what must be used is Set-ADUser. I’ve spent many hours trying to figure out WHY Set-ADUser throw errors when all the information in the CSV is accurate. What I’ve realized is… Set-ADUser will throw errors “IF THERE’S AN EMPTY EXEL CELL AND YOU’RE TRYING TO MAP THE VALUE OF SUCH CELL AS A PROPERTY IN ACTIVE DIRECTORY USER ACCOUNT OBJECT”.
    I have user accounts whose INITIAL property doesn’t matter so they’re empty cells in my CSV, but the foreach() script block is taking it into account so I had errors (nothing that could be easily realize in the error message by the way).

    So… in order to get this covered, I had to add $ErrorActionPreference = “SilentlyContinue” at the beginning of the script.

    Lastly, Set-ADUser won’t modify Fullname property. Again… if for some reason HR give you a list with this value changed, the way I’ve covered this is by adding Get-ADUser -Identity ($User.SamAccountName) | Rename-ADObject -NewName $User.DisplayName -Verbose within foreach() script block.

    I hope this helps someone who faced the same issues I’ve faced, or needs to achieve the same goals as I have.

    Thanks a lot Robert. Your script gave me the starting point of my whole search!

    • Robert Allen on September 23, 2018 at 12:25 pm

      Fernando thanks for the details, I’m sure this will help others.

      The script I provided is very basic so I’m happy you was able to use it as a starting point.

  9. Umair Ahmed on September 26, 2018 at 10:14 am

    Thanks for this great knowledge

  10. Kashef on September 26, 2018 at 4:45 pm

    Hi Robert
    What if you wanted to bulk update existing AD users by populating fields with values

    • Robert Allen on September 28, 2018 at 12:26 pm

      I’m going to write a separate post on this subject. Is there anything specific you would like to see examples of?

  11. Ibrahim on October 27, 2018 at 5:40 pm

    Honestly, took me whole day to figure out why PS method didn’t work and user import tool works so better. Found out that it was due to wrong OU information, no doubt in that your tutorial is so step by step helpful guide for experts or newbies.

Leave a Comment