top of page

PowerShell New-ADUser

$MyAccounts= Import-csv "C:\temp\Users.csv"
Foreach($Account in $MyAccounts){
$Names=($Account.Firstname)+($Account.Lastname)
New-ADUser -Name $Names -EmailAddress $Account.Email -SamAccountName $Account.Samaccount -DisplayName $Names -GivenName $Account.FirstName `
-Surname $Account.LastName -UserPrincipalName $Account.UPN -Enabled $true -ChangePasswordAtLogon $False -AccountPassword `
(ConvertTo-SecureString -AsPlainText "$($Account.PassWord)" -Force) -passthru -PasswordNeverExpires $True -CannotChangePassword $True `
-Description  $Account.Description -Company "Scripts By Scott" -Path $Account.OU -ErrorAction Stop
}

Sample CSV File

New-ADuser1.PNG
bottom of page