By using this site, you agree to the Privacy Policy.
Accept
EnterinITEnterinITEnterinIT
  • HOME
  • IT PRO
  • TECH
  • MICROSOFT
    • Azure
    • ConfigMgr/SCCM
    • DPM
    • Orchestrator
    • Hyper-V
    • Microsoft Edge Insider
    • MSI
    • Office 365
    • Office Insider
    • Power BI
    • Skype
    • SQL Server
    • Teams
  • WINDOWS
    • Windows Admin Center
    • Windows Client
    • Windows Server
  • SCCM Query Collection List
Reading: How to Change a User’s Primary Email Address in Office 365 using PowerShell
Font ResizerAa
EnterinITEnterinIT
Font ResizerAa
  • HOME
  • IT PRO
  • TECH
  • MICROSOFT
  • WINDOWS
  • SCCM Query Collection List
Search
  • HOME
  • IT PRO
  • TECH
  • MICROSOFT
    • Azure
    • ConfigMgr/SCCM
    • DPM
    • Orchestrator
    • Hyper-V
    • Microsoft Edge Insider
    • MSI
    • Office 365
    • Office Insider
    • Power BI
    • Skype
    • SQL Server
    • Teams
  • WINDOWS
    • Windows Admin Center
    • Windows Client
    • Windows Server
  • SCCM Query Collection List
Office 365

How to Change a User’s Primary Email Address in Office 365 using PowerShell

Published February 11, 2024
2 Min Read
SHARE

How to Change a User’s Primary Email Address in Office 365 using PowerShell.

1. Run the PowerShell as administrator;

2. To run the scripts needed to change a user’s primary email address we must first set the script execution policy.

Get-ExecutionPolicy

3. The execution policy needs to be RemoteSigned. RemoteSigned allows only downloaded scripts signed by a trusted publisher to be run. If Get-ExecutionPolicy doesn’t return RemoteSigned, it must be changed by typing the following cmdlet and entering a “y” when prompted;

Set-ExecutionPolicy RemoteSigned

4. Now Get-ExecutionPolicy returns RemoteSigned;

5. Next we need to provide Office 365 with administrative credentials to be able to make changes. We’re going to assign our credentials to the variable $cred;

$cred = Get-Credential

6. And PowerShell prompts for an Office 365 account with administrative permissions;

  7. After entering the credentials of an Office 365 administrator account and clicking OK, we need to open a connection to the Office 365 servers;

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $cred -Authentication Basic -AllowRedirection

8. Once the connection is open we need to import the commands for the Exchange Server shell;

Import-PSSession $Session

9. The following command sets a user’s primary email address from the current address to the desired address without changing the username;

Set-Mailbox -identity <user@current.com> -WindowsEmailAddress <user@new.com>

10. The Office 365 online administrative interface should show the new email address as the primary;

11. Don’t forget close session;

Remove-PSSession $Session
TAGGED:Exchange OnlineMicrosoft Office 365PowerShellWindowsWindows 10
Previous Article Configuration Manager Query Collection List Configuration Manager Windows Server 2016 Active Directory Schema
Next Article Windows 10 Creators Update Update Assistant tool
Leave a Comment Leave a Comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Translation

English中文(简体)DanskNederlandsFrançaisDeutschItaliano한국어PolskiPortuguêsRomânăEspañolУкраїнська
by Transposh - translation plugin for wordpress

Popular Posts

System Requirements for Windows Server 2016
Windows Server
Configuration Manager Query Collection List
Configuration Manager Query Collection List
ConfigMgr
Structured/Managed Navigation enabled on Modern Pages in Classic Team Sites
Tech
SCCM Failed to get DP locations as the expected version from MP
ConfigMgr

Recent Posts

Installing and Configuring Fail2ban for SSH Protection on Ubuntu 24.04
Linux
Enabling and Configuring FirewallD on AlmaLinux
Linux
User Creation and SSH Key Setup in AlmaLinux
Linux
How to reset password on AlmaLinux
Linux

© 2023 EnterinIT

Go to mobile version
adbanner
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?