0

I have the following issue when adding bulk users through a .csv file: the user logon name and the domain are blank, however the user logon name (Pre windows 2003) is showing ok. Because of this, I am unable to sign in any of my newly imported users.

My .csv looks like this. I'm using excel formulas to concatenate, extract given name first letter, etc.

fname,sname,Name,sAMAccountName,cn,sn,Description,Department,Path,Password,Enabled
Jaunita,Mendoza,Jaunita Mendoza,jmendoza,Jaunita,Mendoza,Training Account,Trainees,"OU=London,OU=Adatum,DC=lab,DC=local",Pa$$w0rd,$FALSE

The powershell script I'm using looks like this:

Import-Csv .\users.csv | foreach-object {
$userprinicpalname = $_.SamAccountName + "@{lab}.local"
New-ADUser -SamAccountName $_.SamAccountName -Name $_.name 
-DisplayName $_.name -GivenName $_.cn -SurName $_.sn 
-Description $_.Description -Department $_.Department 
-Path $_.path 
-AccountPassword (ConvertTo-SecureString "Pa$$w0rd" -AsPlainText -force) 
-Enabled $True -PasswordNeverExpires $FALSE -PassThru 
}

Any suggestions please?

1 Answers1

1

Looks like you've set the UPN correctly but are not putting it in the new-aduser command? UPN is optional so the account can be created without it.

smwk
  • 570
  • 2
  • 4
  • 14