Create Active Directory Bulk Users from CSV using PowerShell

Create Active Directory Bulk Users from CSV

It might not be common for every server administrator to need to import a large number of users at once. However, if you do, the process can be automated and save you massive amounts of time. It requires a little bit of leg work to set things up but once the process starts it’s amazingly fast. The basic workflow of this is to create a CSV file in Excel of all your users and their attributes. You would then import that file in Active Directory using a Powershell Script. The import itself takes seconds instead of spending 5-10 minutes per user the manual way.

CSV File Format: 

Name | GivenName | DisplayName | EmailAddress | UserPrincipalName | SamAccountName | Title | Department | Company | Path | AcountPassword

PowerShell: 

Import-Csv C:\newusers.csv | foreach {New-ADUser -Name $_.name -GivenName $_.name -Surname  $_.GivenName -displayname $_.displayname -EmailAddress $_.EmailAddress -UserPrincipalName $_.UserPrincipalName -SamAccountName $_.SamAccountName -Title $_.Title -Department $_.Department -company $_.company -Office $_.Office -City $_.city -OfficePhone $_.OfficePhone -MobilePhone $_.MobilePhone  -Path $_.Path -Accountpassword  (ConvertTo-SecureString -AsPlainText $_.AccountPassword -Force) -Enabled $true -ChangePasswordAtLogon 0}