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

Method 1: Using PowerShell to import ad users from a CSV
Method 2: Using GUI Tool to bulk import AD users

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

I created a GUI tool to make it super easy to create bulk users and it requires no PowerShell experience. It also supports adding users to multiple groups.

What you will need

Step 1: Download and Install the GUI import tool

The install is very simple:

1. Extract the downloaded zip file and run the installer file -> AD Pro Toolkit Demo Installer.msi

2. Click next on the Welcome screen

3. Choose destination path (default is fine) click next

5. Click Next

6. Click Close

Install finished! You will find the Bulk User Creation tool in the Start Menu.

Step 2. Bulk User Creation Tool CSV Setup

The next step is to generate the CSV template and fill out the user details.

Open the tool and click on generate csv template

You will be prompted to save the csv template. You can change the name and save it any where you like.

Now open the CSV template and fill out the fields you need.

Key points

  • The only required field is the sAMAccountName, the rest are optional.
  • Don’t delete columns, if you don’t need one just leave the row blank for the user.
  • 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 and add them to multiple security groups.

When you have your CSV template ready just save it and move to step 3.

Step 3. Select CSV and run the import. 

The next step is to select the template from the GUI tool and click run.

You will see the progress in the lower left. In addition, you will see the process in the log box, it will show any errors in red and all properties that were set in green.

All 39 users I set in the CSV completed. Now, I’ll go into Active Directory users and computers and verify some of the settings.

Looks like the users were added to the organizational units.

Now lets check if the user was added to the security groups.

Yes! It worked, it created the account and imported all the fields I set.

The GUI tool making the bulk importing process very very easy, no coding or PowerShell experience is needed. This tool is only $49 and can be purchased here

I have shown you two methods for creating bulk users in Active Directory, try them out and decide which one works best for you.

You Might Also Like…

Recommended Tool: SolarWinds Server & Application Monitor

This utility was designed to Monitor Active Directory and other critical services like DNS & DHCP. 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 Here

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

      • MC on June 30, 2020 at 1:06 pm

        What about adding attributes like ProxyAddresses or UserPrincipleName?

        • Robert Allen on July 2, 2020 at 7:40 pm

          Yup those can be added. The GUI Tool already has them included in the CSV template.

  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. Ehtesham on July 5, 2018 at 6:25 am

    Can we use the GUI tool to import attributes for pre-existing user accounts in AD.

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

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

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

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

    Thanks for this great knowledge

  11. 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?

      • Biju Mathew on November 29, 2018 at 4:40 pm

        Hi Robert,

        Did you get a chance to write a separate post on bulk update of existing AD users?

        • Robert Allen on December 17, 2018 at 9:53 pm

          I’ve created a GUI tool for this, it’s very very close to being completed. It’s basically PowerShell with a GUI.

  12. Brett J on October 10, 2018 at 3:29 am

    Can the Solarwinds tool be used to just update attributes to existing users?

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

  14. stranger on November 14, 2018 at 11:39 am

    can you add an option to add to groups? i am copying from a template so if i use your script, i will need to add the users to groups manually.

    • Robert Allen on September 7, 2019 at 8:35 pm

      Yup. I’m working on a GUI version that will include many more options including adding to group.

  15. Ricky Clemmons on November 27, 2018 at 7:36 pm

    Hi,

    Im trying to figure out how to script adding proxyaddress

    • Robert Allen on January 5, 2019 at 9:45 pm

      I’ve created a tool for that. Check out the full how to guide -> https://activedirectorypro.com/how-to-bulk-modify-ad-user-attributes/

    • Shane McFadden on November 25, 2019 at 3:53 pm

      Hi Ricky / anyone else wondering how to do this,

      For additional attributes that don’t have a specific PowerShell property, you can use:
      New-ADUser -OtherAttributes @{‘proxyAddresses’=$proxyAddresses}
      In this case, for a proxy address. You can include as many as you like in the curly brackets, I included {‘co’=$co} for the full country name as New-ADUser doesn’t have a property for directly setting it (only the country code, e.g. US).

      Hope that helps.

  16. G.Ashraf Ali on January 17, 2019 at 11:48 am

    Thank you, it was very helpful and a nice GUI tool

  17. Tim B. on March 7, 2019 at 9:42 pm

    Thank you. Thank you. Thank you.

    Every year I need to create 180+ “new Student” Accounts in AD. With a little modification of the amazing ground work you have shared with the world, you have saved me days of manually entering in each account. I used the Powershell and .csv approach, and it works flawlessly! Previously I have used some “trial software” that had obvious limitations, and expectations, but knew there had to be a way Powershell could do it. And here you are! Thank you so very much for sharing this.

    • Robert Allen on March 7, 2019 at 11:50 pm

      Tim, glad this worked for you. Thanks for the feedback.

  18. Thao on March 29, 2019 at 10:27 am

    Hi Robert,

    Thank you for this helpful post.

    I would like to upload a users with option Password Never Expires in Account tab. How do I set this option in .csv file?
    Thank you
    Regards,
    Thao

    • Robert Allen on September 7, 2019 at 8:32 pm

      That is a big security risk, I would not recommend doing that.

  19. TAMMY GUTH on May 2, 2019 at 4:13 pm

    So, the same as the last commenter, every year we have the need to create hundreds of new student accounts. Additionally, we have summer school classes that are open to non-district kids. So, that is a bunch more accounts that are created every year! We were contracting this bulk creation out to our network support people. But you tool works like a dream and will save us time AND money! One question though: the Sam-Account-Name isn’t populating the user logon name in AD…shouldn’t it? Or do I have to map that somewhere else? Additionally, when I look at the OU in AD, I would like to see the students’ names in the Name column rather than the Sam-Account-Name. What do I need to change to make these things happen? Thanks!!

  20. Cindy on October 17, 2019 at 3:32 pm

    Thank you so much. This has been a life saver. I saw in one of the comments you were working on a solution for adding to Groups. Has this been completed? It would help out a lot in my environment.

  21. tom on March 13, 2020 at 9:50 pm

    thanks for your assistance to date
    how can i generate a new random username in your script………

  22. S M on April 11, 2020 at 2:12 am

    Thanks very much, for providing a few options for bulk creating users on AD. Very, very useful info.
    Nicely done, to the point and detailed! Impressive work you have done. Many thanks!!

  23. Sam on May 15, 2020 at 9:43 pm

    Great tool, was hoping it would work for me but I can’t past an [Access is Denied.] error when I attempt the import. Know the credentials I’m using are good; I can manually create a user just fine. Pared the attributes down to just three fields (Sam-Account-Name, Passwod, OrganizationalUnit) and one record, fails every time. Tried several different OU’s, same error.

    Any ideas?

    • Robert Allen on September 20, 2020 at 1:55 pm

      Hi Sam. Is this with the script or GUI tool? If you purchased the GUI tool send me an email. I need to make sure you are on the latest version, there have been several updates.

  24. islam oda on July 28, 2020 at 9:53 pm

    thanks, it’s worked with me

Leave a Comment