- TCB Network Solutions
- Change O365 Username via PowerShell
Change O365 Username via PowerShell
Change O365 Username via PowerShell
Open Windows PowerShell as an Admin and enter the following commands:
- connect-msolservice –> Enter Global Admin credentials
- Set-MsolUserPrincipalName -UserPrincipalName “username@xxxxx.onmicrosoft.com” -NewUserPrincipalName “username@correctdomain.com”
Note: It is tricky to connect to O365 via powershell using an admin account that has 2FA enabled. As a work-around, search for (or create) a temp account called TCB@xxxx.onmicrosoft.com and assign it Global Admin rights and use that account for the powershell session.
Once done, remove the Global Admin rights and disabled the account since it does not have 2FA.
Add the domain and full user to the Block Lists.