Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to import users into AD using a CSV file, PowerShell, and Quest's AD CmdLets. When the users are added the UserPrincipleName is not added.

Here is a sample CSV:


FirstA,LastA,"First Last",FLastAL.ou1,FLastAL.ou1@clients.domain.local, First2A,Last2A,"First2 Last",FLast2AL.ou1,FLast2AL.ou1@clients.domain.local,

Here is the PowerShell snippit:

$Users = Import-Csv $UserFile
foreach ($User in $Users)
    New-QADUser -FirstName $User.FirstName -LastName $User.LastName -DisplayName $User.DisplayName -SamAccountName $User.SamAccount -Name $User.SamAccount -UserPrincipalName $User.UserPrincipalName -ParentContainer "OU=$OUName,OU=Customers,DC=clients,DC=domain,DC=local"
share|improve this question
up vote 1 down vote accepted

I think the problem was the fact that we are using Exchange 2007 which does not use RUS. When I used the Exchange 2007 CmdLets to do the same thing everything is working correctly.

share|improve this answer

You don't need to set the UPN, it's automatically generated for you:

Even if you did manage to set it (and we did once) you're creating a situation where the UPN does not follow convention, so you run the risk of something breaking somewhere down the line (normally an application that assumes it always follows convention).

share|improve this answer
Hey mh. Thanks for the feedback. I initially tried not setting it an it did not get created automatically. I assumed that was an artifact of the way the New-QADUser CmdLet added the user. That is why I tried setting it but that isn't working either. – Matt Spradley Jun 1 '09 at 18:40
Been a while since I checked but if memory serves the UPN is created when the user logs on or something similar. – 21st Century Moose Jun 1 '09 at 19:19

I don't know why the New-QADUser cmdlet won't let you assign the UPN directly. This should work just fine. Although it will be a little bit slower if you are processing a very large number of accounts

$Users = Import-Csv $uf
$OUName = "some specified OU"
foreach ($User in $Users)
    $u = New-QADUser -FirstName $User.FirstName -LastName $User.LastName -DisplayName $User.DisplayName -SamAccountName $User.SamAccount -Name $User.SamAccount -UserPrincipalName -ParentContainer "OU=$OUName,OU=Customers,DC=clients,DC=domain,DC=local"
    $u.UserPrincipalName = $user.UserPrincipalName
share|improve this answer

I checked with the latest QAD release (v1.2) and it works just fine.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.