How to Create Bulk Users in Active Directory using Powershell

Published: 06 June 2016
on channel: ITPandas0011
29,836
126

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:\Scripts\NewUsers.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

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


Watch video How to Create Bulk Users in Active Directory using Powershell online without registration, duration hours minute second in high quality. This video was added by user ITPandas0011 06 June 2016, don't forget to share it with your friends and acquaintances, it has been viewed on our site 29,836 once and liked it 126 people.