How to create Bulk Users in Active Directory !!


Firstly Create a CSV file in following format :







Go through the CSVformat (Some pointers explained)

Path : Would be the path where you want the Users to get created.

How to find the path :



- Open Active Directory Users and Computer
- Expand your Domain Name / Organization name
- Right Click on the OU where you want the users to get created
- Click on Properties
- Click on Attribute Editor
- Look for Distinguish Name , copy the value
- Paste that in the path of the CSV file

UserPrincipleName : This can vary depending upon the email servers and even .local addresses can appended in there. It has to match your domain name standards.

After adding all the details in the CSV file , save that as bulkupload.csv and copy the file to the Active Directory Server. I am placing my file on the Desktop of the AD server.

Open Windows PowerShell in Elevated permissions (Run As Administrator) and run the following command after modifying the .csv file path.

Import-Csv "C:\Users\binuk\Desktop\bulkupload.csv" | foreach-object { New-ADUser -Name $_.DisplayName -UserPrincipalName $_.UserPrincipalName -SamAccountName $_.Username -GivenName $_.GivenName -DisplayName $_.DisplayName -Initials $_.MiddleInitial -SurName $_.Surname -Path $_.Path -AccountPassword (ConvertTo-SecureString $_.Password -AsPlainText -force) -Enabled $True -PasswordNeverExpires $True -PassThru }

It will go through the task and will show you the results.

If the User already exist , it will throw an error

OR

If 2 users have same value it will throw an error, Like for example : If we have David Lawson and David Landing , in this case the Username shows as conflict , both will be show as DavidL.

So please make adjustments accordingly in the CSV file and run the command again.


Download Remote Control Software : www.wingagaarbin.com


Comments

Popular posts from this blog

How To Work On Cross Site Failure in Exchange 2010 Environment (Failover and Failback)

Activate Exchange 2010 Manually

Migrating SBS 2003 to Windows Server 2008 with Exchange 2007