Configure Email Forwarding for an Office 365 (Exchange Online) Mailbox – PowerShell

Configuring email forwarding for an Office 365 (Exchange Online) mailbox can be done in three ways. The user can enable email forwarding on their own using the OWA and editing their settings. This post is going to show how to enable email forwarding on a mailbox from PowerShell. If you are looking at how to complete this with the Exchange Admin Center, please see this post Configure Email Forwarding for an Office 365 (Exchange Online) Mailbox – Exchange Admin Center.

  1. Open a connection to Exchange Online with PowerShell

Make sure to replace “user@domain.com” with the user whose email you want to forward.

Make sure to replace “forward_recipient@domain.com” with the SMTP address to where you want to forward the email to.

  1. If you want to forward email and keep a copy in the local mailbox, execute this command

    Set-Mailbox -Identity “user@domain.com” -DeliverToMailboxAndForward $true
    -ForwardingSMTPAddress “forward_recipient@domain.com”

  2. If you want to forward email and don’t keep a copy in the local mailbox, execute this command

    Set-Mailbox -Identity “user@domain.com” -ForwardingSMTPAddress “forward_recipient@domain.com”

To verify this worked, run the following PowerShell command. This will display the user, the primary SMTP address and the forwarding SMTP address.

Get-Mailbox -Identity “user@domain.com” Format-List DisplayName,PrimarySMTPAddress,ForwardingSMTPAddress

Leave a Reply