How To Create Bulk Users In Active Directory Using Powershell


Power Shell Scripting for Bulk User Creation in Active Directory. Copy and Pest into notepad and save as the below in .PS1 extension
==========================================================================================================

Import-Module ActiveDirectory
Import-Csv “C:ScriptsNewUsers.csv” | ForEach-Object {
$userPrincinpal = $_.”samAccountName” + “@local.test”
New-ADUser -Name $_.Name `
-Path $_.”ParentOU” `
-SamAccountName $_.”samAccountName” `
-UserPrincipalName $userPrincinpal `
-AccountPassword (ConvertTo-SecureString “123456” -AsPlainText -Force) `
-ChangePasswordAtLogon $true `
-Enabled $true
Add-ADGroupMember “Domain Admins” $_.”samAccountName”;
}

==========================================================================================================

Copy and Pest it into notepad and save it as .CSV formate

Name samAccountName ParentOU
test test1 OU=HR,DC=local,DC=test
test test2 OU=HR,DC=local,DC=test
test test3 OU=HR,DC=local,DC=test
test test4 OU=HR,DC=local,DC=test
test test5 OU=HR,DC=local,DC=test

==========================================================================================================