Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9174961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:50:17+00:00 2026-06-17T16:50:17+00:00

I am writing up a Powershell Script to automatically pulling info from one database

  • 0

I am writing up a Powershell Script to automatically pulling info from one database to update Active Directory, e.g. adding new users.

I am new to Active Directory and am using this useful graphic maps to link UI label to AD attributes

I would expect the UserPrincipalName, e.g. tina.Tana@example.com, is the unique identifier of user accounts.

But during testing, it turns out otherwise. If I do:

$status = New-QADUser -FirstName 'Tina' -LastName 'Tana' -Name 'Tina A Tana' `
            -UserPrincipalName 'tina.tana@example.com' `
            -ParentContainer 'OU=OU2,OU=OU2,DC=example,DC=com'
$status = New-QADUser -FirstName 'Tina' -LastName 'Tana' -Name 'Tina B Tana' `
            -UserPrincipalName 'tina.tana@example.com' `
            -ParentContainer 'OU=OU2,OU=OU2,DC=example,DC=com'

2 accounts will be both created OK, with the only difference being the -Name field.

If I do:

$status = New-QADUser -FirstName 'Tina' -LastName 'Tana' -Name 'Tina Tana' `
            -UserPrincipalName 'tina.tana-1@example.com' `
            -ParentContainer 'OU=OU2,OU=OU2,DC=example,DC=com'
$status = New-QADUser -FirstName 'Tina' -LastName 'Tana' -Name 'Tina Tana' `
            -UserPrincipalName 'tina.tana-2@example.com' `
            -ParentContainer 'OU=OU2,OU=OU2,DC=example,DC=com'  

The difference is only the -UserPrincipalName . the 2nd add-user will fail, PS says user already created. I tried other combinations, but it indicates -Name must be unique, other fields do not matter.

Have I missed anything? It seems to me that people can have a same name, but the when creating an account, the user principal name SHOULD be unique. (When you manually create a new user AD account using AD User and Computers GUI tool, if you give a same logon name (i.e. userPrincipalName) to different people, the tool will tell you you must give a different logon name.

So why is it different when doing it from Powershell using Quest Add-QADUser? Why when doing it from Powershell, the command will be executed successfully?

puzzled!
Many thx for your input!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:50:18+00:00Added an answer on June 17, 2026 at 4:50 pm

    Read this microsoft KB and this msdn library

    Active Directory itself does not enforce uniqueness of a UPN. The process that creates or modifies the UPN is responsible to check for uniqueness (this is done by querying the global catalog).
    Probably New-Qaduser doesn’t do this check.

    Usually the unique identifyer for an user is the samAccountName.
    If you don’t set the UserPrincipalName AD build a default one:
    the user principal name has two parts: the UPN prefix (the user account name) and the UPN suffix (a DNS domain name). The parts are joined together by the at sign (@) symbol to make the complete UPN. For example, the user Someone who has an account in the Example domain would have a UPN of “someone@example.com”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently writing a Powershell script that's used to select a user from Active
I am writing a PowerShell script that will back up several folders from my
I'm writing a powershell script for deployment. I need to copy changed files from
I'm writing a Powershell script that will extract a set of data files from
I am writing an executable from a PowerShell script that needs to put the
I'm writing a PowerShell script that uses the SharePoint 2010 New-SPWeb cmdlet to create
I am pretty new to powershell. Need help in writing a script to count
Writing a Powershell script that deletes all the contents from the recycle bins for
I am writing a powershell script to set up some HyperV VM's however there
I'm getting a little frustrated on a little PowerShell script I'm writing. Basically I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.