Set forwarding address for everyone.

office-365-logo

Short but useful script to set forwarding email address for every user in your Office 365 tenant. Can be useful for example if a company have been acquired, and the new owners want them to use theire email domain. Forwarding can then be a good temporary/quick fix to catching all emails to the old domain.

$Mailboxes = Get-Mailbox | Select-Object identity,alias
Foreach($Mailbox in $Mailboxes) {
    $MailAlias = $Mailbox.alias
    Set-Mailbox -identity $Mailbox.identity -ForwardingSMTPAdress $MailAlias+"@contoso.com"
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s