Create bulk users from .csv in AD using Powershell
Ajey Gupta
While working as System Administrator, you come across with a situation where you have to create bulk users from .csv as new hires into your company’s Active Directory Users & Computers. Doing this task manually can be hectic and time consuming.
There are many Powershell Scripts out there which sometimes seems confusing and doesn’t even work. Let’s check the easy way out to create bulkusers in Windows Server local Active Directory.
Easy Steps to Add Bulk Users into Active Directory:
a) Create your .csv similar to the below format. To download below sample as .csv file,click here.
GivenName
Surname
samAccountName
DisplayName
Password
Ajey
Gupta
Ajey.gupta
Ajey Gupta
Pass@123
Ashish
Pandey
Ashish.Pandey
Ashish Pandey
Pass@123
Deepak
Shaw
Deepak.shaw
Deepak Shaw
Pass@123
Asha
Sharma
Asha.Sharma
Asha Sharma
Pass@123
Manisha
Verma
Manisha.Verma
Manisha Verma
Pass@123
Alexa
Simmons
Alexa.Simmons
Alexa Simmons
Pass@123
Alisa
Ward
Alisa.Ward
Alisa Ward
Pass@123
Lovely
Singh
Lovely.Singh
Lovely Singh
Pass@123
Pooja
Jain
Pooja.Jain
Pooja Jain
Pass@123
Vignesh
Kumar
Vignesh.Kumar
Vignesh Kumar
Pass@123
Friends, I have added only 10 users in the .csv file. You can add as many users in the above format.
b) After downloading the sample .csv, edit it by adding your real users Given names, Surname, SamAccountName, DisplayName and Passwords.
c) Run the script to create bulk users from .csv into your Active Directory Users & Computers.
d) Open Powershell with Run as Administrator and go to the location where the script“CreateNewUsers.ps1“ is downloaded.
e) Let’s assume you downloaded it on C Drive, then type C:\.\CreateNewUsers.ps1 and press enter, it will ask you to browse to the location where .csv file is located. Select your .csv file and Press Ok.
f) Finally refresh your Active Directory Users & Computers and you will find a new Organizational Unit created with the name “NewUsers” and all your new hire users from .csv will be added inside it.
You can edit the name of the OU, movethem to different OU, or can even change the name of the OU in the script beforerunningit.
You can also copy the script & edit it directly in the notepad before running it (script in .ps1 is also available above):
I hope the above script will help you make your life easier. In case you have any specific requirements, do let me know by emailing me at ajey@akginfotech.com.
Thanks a ton for reading my above blog. If you have any comments, suggestions, or feedback please spare a second to post it.