< -- BuySellAds Ad Code ALLEN -->
Active Directory

How to Add Alternative UPN and Change Default UPN

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","external.com"); $_ | Set-ADUser -UserPrincipalName $newUpn}


Tags: 365, Active directory

Allen White

Allen is an IT Consultant and holds the following accreditations. MCSA, MCSE, MCTS, MCITP, CCA, CCSP, VCP 4,5, 6 and HP ASE, AIS - Network Infrastructure.

Leave a comment



What Web Browser Do You Use?

View Results

Loading ... Loading ...


What do you prefer..VMware or Hyper-V?

View Results

Loading ... Loading ...