change username in AD and O365

How to Change Username in AD and O365 without deleting the Profile

Change Username in AD and O365

Read to know how you can change username in AD and O365 without having to delete the profile of the user.

  1. Connect to your DC Server using Admin credential
  2. Then, open AD Users and Computers and select that user needs to be updated name
  3. Right-click and renamechange username
  4. Set the Full name old username to new username and add appropriate Full name, First, Last and Display name (new username)
  5. Make sure the Mail attribute is with a new username by checking in user propertieschange usernames in ad properties
  6. Open Elevated Windows PowerShell in DC Server and run sync command to sync newly added username to O365 by using this command: “Start-ADSyncSyncCycle -policyType Delta”policy
  7. Go to the O365 admin portal using the Admin credential and check the name. You may see the old username but with a new Display name.
  8. Now, connect to DC again and open Elevated Windows PowerShell to sync the same name as the display name in O365 like AD.
    Use this command: Connect-Msolservice and enter Admin credential and then
    run 2nd command: Set-MsolUserPrincipalName -UserPrincipalName -NewUserPrincipalName
  9. Go to O365 and check and it must be showing a new name.
  10. Connect user PC/Machine with the new username.
  11. Open Elevated Command Prompt and run whoami in Command Prompt. You might see an old username as a profile path.
  12. Then, login with Admin user in same PC/Machine and go-to C:Users and rename old username with new username.
  13. Open Elevated Command Prompt and run this command to sync “gpupdate /force” and sign outupdate policy ad & o365
  14.  Login with a new user account, we can see that this user logged in with a new user but in c:userstemp profile.
  15. Now, open Regedit in user machine and go to path HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionProfileList and check for profile image path C:UsersTemp and rename it with “.temp” instead of “Temp” at the last in the profile listregistry editor AD
    registry editor
  16.  Remove “.back” from the Profile image path C:usersold username to change it with  C:Usersnewuser name.
  17. Login with a new username on PC/Machine and check the user profile path by opening CMD. it should be like C:Usersnewuser profile path.
  18. At last, check any shared drive/network drive path or any path linked (like Roaming Profile etc) from DC. This is to make sure all data appear correctly to the new user profile in the new user PC/Machine. 


We keep uploading new blogs every week on our website- keep an eye out for those.
Lastly, if you need help with more such IT Solutions, feel free to reach out to us. We’ll be happy to resolve your queries.

Sumit Khorava
Sumit Khorava

Sumit is a Network & Systems Engineer and has been a part of us for almost 3 years now. He has a total of 5 years in the IT Field. He is an MS AZ103 and a Six Sigma certified engineer. At Infrassist, he started off by providing support/helpdesk services to one of our US clients. Then he moved to another project from Europe for which he currently manages and does Server and System Maintenance, Backup configuration and maintenance, ESET Management, Azure AD, Manage O365 Portals and their Security and Compliances.

Thanks For Reading