Sylver SCHORGEN Blog's

Articles, astuces et news sur les technologies Microsoft et plus particulièrement tournant autour de Powershell
    • 22/10/2018

    [POWERSHELL] Configure Exchange Online email forwarding

    Hi everyone,

    I've created a PowerShell script to add an email forwarding rule on a mailbox for Exchange Online. What this script does is :

    • Connect to Exchange Online : You will be prompt for an admin credentials
    • Verifying that the source email address does not already have a forwarding rule
    • If your source email address does not have a forwarding rule, the script creates the one your want to configure
    • By default, the script keeps a copy of every email in the source mailbox and forward the email. If you don't want to keep a copy in the source mailbox, you can add the parameter -KeepACopyAndForward with the value $false

    I've added some verbose log in order to know what the script is doing :)

    How to use the script :

    .\New-O365EmailForwardingRule.ps1 -sourceEmailAddress "john.doe@mail.com" -DestinationEmailAddress "jean.dupont@mail.com"
    .\New-O365EmailForwardingRule.ps1 -sourceEmailAddress "john.doe@mail.com" -DestinationEmailAddress "jean.dupont@mail.com"
    -KeepACopyAndForward $false

    The Link of my script : https://github.com/sschorgen/PowerShell/blob/master/O365_New-O365EmailForwardingRule/New-O365EmailForwardingRule.ps1