We made it to Wednesday, so now we get a PowerShell One-Liner to make your life easier. Here’s the scenario, HR comes to you and says you need to forward Mark Smith email to John Ralph as soon as possible. Instead of opening up your 365 Exchange Admin portal and logging in, then finding Mark Smith, then finding the Forward option, then typing in John Ralph’s email and saving it.
All you need to do is your Connect to 365 Exchange Portal with Secrets” script, then run
Set-Mailbox msmith@email.com -FowardingAddress jralph@email.com
That is it! Seriously, that’s all you need to do. If your not doing anything else with 365 right away, I would disconnect the session.
One Parameter you can add is -DeliverToMailboxAndForward $true, which will save email sent to the original intended email, but still forward the email as well.
Hope this helps you out, and I’ve used this before in other scripts and created functions to add even more functionality.
PowerShell Help:
Microsoft Learn
Leave a Reply