Exchange Online Forwarding

Aus abotpedia
Version vom 19. Juni 2015, 13:11 Uhr von MWorschech (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „Exchange Online: Setting mail forwarding with PowerShell One of Exchange Online functionalities as part of the Office365 suite is the ability to forward mails…“)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Wechseln zu: Navigation, Suche

Exchange Online: Setting mail forwarding with PowerShell

One of Exchange Online functionalities as part of the Office365 suite is the ability to forward mails to another mailbox or smtp address quick and easy using the users Office365 portal. Besides, what happens when you have to do it as an admin on 500 users at a time? it results tedious right?.

Well, we can do this quickly with the help of PowerShell with the following commands:

Forward mails to another mailbox:

<syntaxhighlight lang=powershell>Set-Mailbox user@domain.com -ForwardingAddress dest_mailbox@domain.com</syntaxhighlight>

Forward mailbox without saving a local copy:

<syntaxhighlight lang=powershell>Set-Mailbox user@domain.com -ForwardingAddress dest_mailbox@domain.com -DeliverToMailboxAndForward $false</syntaxhighlight>

Forwarding mails to another external mailbox:

<syntaxhighlight lang=powershell>Set-Mailbox user@domain.com -ForwardingSmtpAddress ext_mailbox@domain.com</syntaxhighlight>

Forwarding mails to another external mailbox without saving a local copy:

<syntaxhighlight lang=powershell>Set-Mailbox user@domain.com -ForwardingSmtpAddress ext_mailbox@domain.com -DeliverToMailboxAndForward $false</syntaxhighlight>

Apply the forwarding to users in mass:

<syntaxhighlight lang=powershell>Get-Mailbox | Where {$_.RecipientType -eq “UserMailbox”} | Set-Mailbox -ForwardingAddress dest_mailbox@domain.com</syntaxhighlight>

Apply the forwarding to users to be sent to external users in mass:

<syntaxhighlight lang=powershell>Get-Mailbox | Where {$_.RecipientType -eq “UserMailbox”} | Set-Mailbox -ForwardingSmtpAddress ext_mailbox@domain.com</syntaxhighlight>

Get forwarding Info of a user:

<syntaxhighlight lang=powershell>Get-Mailbox -Identity user@domain.com | fl DeliverToMailboxAndForward, ForwardingAddress, ForwardingSmtpAddress</syntaxhighlight>

Remove mail forwarding:

<syntaxhighlight lang=powershell>Set-Mailbox user@domain.com -ForwardingAddress $null</syntaxhighlight>

Remove mail forwarding sent to an external user:

<syntaxhighlight lang=powershell>Set-Mailbox user@domain.com -ForwardingSmtpAddress $null</syntaxhighlight>

Remove mail forwarding to users in mass:

<syntaxhighlight lang=powershell>Get-Mailbox | Where {$_.RecipientType -eq “UserMailbox”} | Set-Mailbox -ForwardingAddress $null</syntaxhighlight>

Remove mail forwarding sent to external users to users in mass:

<syntaxhighlight lang=powershell>Get-Mailbox | Where {$_.RecipientType -eq “UserMailbox”} | Set-Mailbox -ForwardingSmtpAddress $null</syntaxhighlight>