Office 365 – How to Change Primary Email Address For a User

Scenario: Your company uses a sign in domain however some users need to be able to send from a different email as their primary email address.

Example:

  • You sign in with  image
  • Your outgoing email address image

The Office 365 graphical user interface does not currently give you the ability to change this setting.

So you need to be able to get dirty with PowerShell and here are the steps.

Prerequisites:

Download and install Microsoft Online Services Module for Windows PowerShell

Stage 1 – Setting Up PowerShell to receive the commands

  1. Run the PowerShell module as administrator.
  2. Type:
    Set-ExecutionPolicy -ExecutionPolicy unrestricted
    and press Enter
  3. Type:
    $LiveCred = Get-Credential
    and press Enter
  4. You will be prompted to log in. Use your Office365 administrative account.
  5. Type:
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic –AllowRedirection
    and press Enter.
  6. Type:
    Import-PSSession $Session
    and press Enter.

Stage 2 – Getting the email addresses and changing the primary

  1. Type:
    $Mailbox = Get-Mailbox –Identity Jeff
    and press Enter. Where Jeff is the part of the login email address in front of the @ sign (ie. image)

  2. Type:
    ForEach ($i in $Mailbox.EmailAddresses) {Write-Host $i -NoNewline "`b, "}
    and press enter.

    Note:
    You now have all of the information required to change the primary email address. You need to use the output of the previous command to build you next command. We will start by adding something to the front of the output and then remove a comma from the end. Finally we will change capitalization of SMTP within the output to specify which email address is the primary.
    I suggest you copy the output to notepad, make the edits and then copy the final command back.

  3. Add to the front of the output from line 2 type:
    Set-Mailbox Jeff –EmailAddresses

    Note: Jeff is the login name before the @ sign in the email address. This will change based on your account information. Ensure there is a space between the text you just added and the start of the output from step 2.

  4. Now go to the end of the output from step 2 and remove the trailing comma.

  5. Now find the email address you want to make the primary email address within the output from step 2 and capitalize SMTP just before it. You will also need to change the old primary SMTP to miniscule letters smtp.

  6. The command in notepad should look like this:
    image

  7. Copy the command back into PowerShell and press Enter.

    Note: if you need to change more than one email address just repeat the steps in Stage 2.

  8. Once you have finished modifying the primary email addresses you shall issue the following command:
    Remove-PSSession $Session
    and press Enter

Stage 3 – Testing the email addresses

Ensure the users test the email addresses by sending them to a non-office365 email address that you can verify such as Hotmail.

Jeff Loucks
Chief Strategy Officer | Winrox | 425-577-7377

Leave a Reply

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


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>