LEEEJEFFRIES.COM

Change UserPrincipalName for a user on Office 365 when synchronising with AD Connect

 | 

If you are having problems with some of your accounts in Office 365 where you have had to modify the name of an on-premise user but it’s not updating the login name of the user once an AD-Sync has completed, you can run this script below to give the user new UPN in Office 365

[cc lang=“powershell”]

$currentUPN = $newUPN =

Import-Module Online Connect-MSolService Get-MSolUser -UserPrincipalName $currentUPN Set-MSolUser -UserPrincipalName $currentUPN -NewUserPrincipalName $newUPN Get-MSolUser -UserPrincipalName $newUPN

[/cc]

No errors should be seen when running this script if all works okay.

About Me

Photo of Leee Jeffries

I'm an IT professional with over 15 years of experience in the IT industry, I've worked in many fields in my career. This blog is to share my experience, tips and tricks.