Forum Discussion
TH_
Feb 15, 2022Copper Contributor
Forward rule for all users
Hi everyone,
Looking for a clever way to set up a forward rule (all incoming traffic) for all our users from one tenant to another due to a recent acquisition. Was wondering if anyone knows of a powershell script or something similar to accomplish this? Thanks!
- Most third-party t2t migration tools have some way to redirect mail flow, that should be your go-to option. Other than that, PowerShell is your friend - simple loop over all mailboxes, and set the forwarding address to the corresponding @newtenant.onmicrosoft.com address.
2 Replies
- Most third-party t2t migration tools have some way to redirect mail flow, that should be your go-to option. Other than that, PowerShell is your friend - simple loop over all mailboxes, and set the forwarding address to the corresponding @newtenant.onmicrosoft.com address.
- TH_Copper Contributor
I simply created a csv with UPN and the ForwardToAddr and imported that in the script below. Seems to have done the trick.
$users = import-csv '.\UserMailboxes.csv' foreach ($user in $users) { Set-Mailbox $user.UPN -ForwardingSmtpAddress $User.FWD -force Write-Host "$($user.UPN) now forwards to ($user.FWD)" } $users = $null