How to Add Alternative UPN and Change Default UPN

Written by Allen White on. Posted in Microsoft

Imagine the scenario that you need to add an alternative UPN to your active directory, this may as you have a “.local” domain and you need to federate withy our O365 environment and that is a “.COM” domain. As you may not know it makes for best practise to have your UPN match your login details in O365 to make single sign on place nice.

Below I show you first of all the steps to add an alternative UPN and then the Powershell to change the UPN globally.

Add Alternative UPN to Active Directory

  1. Open Active Directory Domains and Trusts.
  2. Right click Active Directory Domains and Trusts and Select “Properties”.
  3. On the UPD suffix add the domain UPN you would like to use.

Change UPN Globally in Powershell for All Users

With the powershell below simple change the “.Local” domain and the “.Com” domain to match your needs.

$LocalUsers = Get-ADUser -Filter {UserPrincipalName -like '*internal.local'} -Properties userPrincipalName -ResultSetSize $null
 $LocalUsers | foreach {$newUpn = $_.UserPrincipalName.Replace("internal.local",""); $_ | Set-ADUser -UserPrincipalName $newUpn}


Allen White
Allen is a Consultant for ITPS in the North East of England and holds the following accreditations. MCSA, MCSE, MCTS, MCITP, CCA, CCSP, VCP 4,5 and HP ASE, AIS - Network Infrastructure.

ITPS provides strategic IT consultancy, implementation, data centre provision and unified communications, as well as support services and workspace and disaster recovery. If you require a consultation then please contact me via the contacts section or direct on 07931222991, add me on linkedin.

Tags: ,

Leave a comment


(c) Please be aware, all information is provided freely, any information used is done so at your risk and Techieshelp will not be held responsible for any issue that may occur.
!-- BuySellAds On-Site Shopping Cart -->