Create a new UPN and use it as default for all your users

If you in ex. want to enable Autodiscover for your mail clients, they need to have their e-mail as their username, and there for the UPN (Universal principal name), has to be changed from domain\user to user@domain.com.

Here is how to do this in Active Directory, and then via PowerShell, change it on all the already created, user accounts.

  1. Open Active Directory Domains and Trusts
  2. Right-click “Active Directory Domains and Trusts and choose “Properties”
    UPN1
  3. Now add the mail domain name to it:
    UPN2
  4. Press OK and your’e done with this part.
  5. Now all the users that already are on the system, needs to have their default UPN replaced, this can be achieved with a PowerShell script:

    Copy the above script to a .ps1 file and run it from powershell, and this, you should see the default domain has be changed on each user account 😉
    Domain

3 comments

  • Matthew Moynahan

    While we realize that this UPN change can be done in bulk for existing users, is there a way to change the default MS AD Behavior to alter the default domain/userid to an UPN like Dept/userid or even better a rotable address like userid@contoso.com?

    I am not aware of a method to do this upon account creation other than changing the underlying Domain Name.

    Sincerely,
    Matt

    • Martin

      Hi Matt,

      Well..I am not aware of anything, that can be set on the domain per default, from my point of view, it will always be the domain of your AD that will be default, but you can add your users with the powershell command “SET-ADUser” from here you create the new user, and the same time set the users default logon name.
      That’s the only workaround I’m aware of.

      Have a great day 😉

      best regards
      Martin

  • MSTechnicalr

    Kind of annoying, considering they recommend ad.domain.com for new AD domains. I see why people use domain.com for their internal domain. I am forced to use a template account or a scheduled task to fix it.

Leave a Reply

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