Before proceed with the user creation create the OU structure in Active Directory Users and Computers snapin and Password Policy.
Create a CSV file that include Organization Users with specific attributes to be imported in the Active Directory. See below example template of mine.
If you want to split User’s name you can use below Excel formula.
To get first name from a cell =LEFT(A2,FIND(“.”,A2,1))
To get last name from a cell =RIGHT(A2,LEN(A2)-FIND(“.”,A2,1))
Active Directory User Creation Template
{attachments}
Save the excel file as CSV (Comma delimited) and copy in to Active Directory Server.
Open Active Directory Module for Windows PowerShell from Administrative Tools.
Change the powershell path. Run below script. (change the CSV file name and domain name)
Import-Csv .\DOITFIXITUsers.csv | foreach-object { $userprinicpalname = $_.SamAccountName + “@doitfixit.local“; New-ADUser -SamAccountName $_.SamAccountName -UserPrincipalName $userprinicpalname -Name $_.name -DisplayName $_.name -GivenName $_.cn -SurName $_.sn -Department $_.Department -Path $_.path; Set-ADAccountPassword -identity $_.SamAccountName -NewPassword (ConvertTo-SecureString -AsPlainText $_.Password -Force) -Reset ; Enable-ADAccount -identity $_.SamAccountName; Set-ADUser -Identity $_.SamAccountName -ChangePasswordAtLogon $true} |
-SamAccountName $_.SamAccountName -UserPrincipalName $userprinicpalname -Name $_.name -DisplayName $_.name -GivenName $_.cn -SurName $_.sn -Department $_.Department -Path $_.path -ChangePasswordAtLogon |
: Damitha : damitha@doitfixit.local : Damitha Anuradha : Damitha Anuradha : Damitha : Anuradha : Engineering : OU=Users,OU=Production,DC=doitfixit,DC=local : Enable User must change Password at Next Log on option |
e.g. To add Description value insert -Description $_.description in to the command line.
Ibrahim says
I still don’t believe it if I am dreaming or I really was able to import bulk users in few minutes where tools like solarwinds and other open source just failed BIG TIME and I spent around 3 hours so far until I came across and this page was my last try before going to sleep in midnight. Thank you very much, God bless you for all your efforts creating this step by step page. Its AWESOME.