23 May, 2025

Office Address

123/A, Miranda City Likaoli
Prikano, Dope

Phone Number

+0989 7876 9865 9

+(090) 8765 86543 85

Email Address

info@example.com

example.mail@hum.com

Powershell

How to create bulk domain users using powershell

How to create bulk domain users using powershell

In this article we will see that how to create bulk domain users using powershell in window server 2008, 2008R2, 2012, 2012R2, 2016 and 2019. Script allows you to bulk create multiple Active Directory users in various OUs without running more than one script. Bulk Users Create Users Multiple OUs Service Accounts Bulk CSV Script should work out of the box without changing the script, just change CSV file.

Powershell script to create bulk user upload with a provided CSV file.

  • # The OUs need to be existant prior to creation else the script will not create the objects
  • # Attachment file needs to be renamed to csv and path need to be updated.
  • # Powershell script to create bulk user upload with a provided CSV file.
  • # The OUs need to be existant prior to creation else the script will not create the objects
  • # Attachment file needs to be renamed to csv and path need to be updated.

Dowload CSV File:

$Users = Import-Csv -Path "C:\adduser.csv"            
foreach ($User in $Users)            
{            
    $Displayname = $User.'Firstname' + " " + $User.'Lastname'            
    $UserFirstname = $User.'Firstname'            
    $UserLastname = $User.'Lastname'            
    $OU = $User.'OU'            
    $SAM = $User.'SAM'            
    $UPN = $User.'Firstname' + "." + $User.'Lastname' + "@" + $User.'Maildomain'            
    $Description = $User.'Description'            
    $Password = $User.'Password'            
    New-ADUser -Name "$Displayname" -DisplayName "$Displayname" -SamAccountName $SAM -UserPrincipalName $UPN -GivenName "$UserFirstname" -Surname "$UserLastname" -Description "$Description" -AccountPassword (ConvertTo-SecureString $Password -AsPlainText -Force) -Enabled $true -Path "$OU" -ChangePasswordAtLogon $false –PasswordNeverExpires $true -server [SERVER_NAME]            
}
PowerShell
About Author

Sysman

Leave a Reply

Your email address will not be published. Required fields are marked *