Office 365 email forwarding powershell

mtkaiser
mtkaiser used Ask the Experts™
on
Does anyone know of any powershell scripts/commands that can list out any and all mailboxes within Office365  that have their email forwarded to another address and/or user?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior Systems Administrator
Top Expert 2014
Commented:
This should get what you want. I would also modify your question to include Powershell as a Topic not just a tag.

Get-Mailbox | select UserPrincipalName,ForwardingSmtpAddress,DeliverToMailboxAndForward

Open in new window


If you want to export to CSV

Get-Mailbox | select UserPrincipalName,ForwardingSmtpAddress,DeliverToMailboxAndForward | Export-CSV C:\UsersForwarding.csv -nti

Open in new window

Author

Commented:
That worked great.  Another question....how would I modify that command to show any users that are configured to be hidden from the address lists?
Joshua GrantomSenior Systems Administrator
Top Expert 2014

Commented:
Running this would show any users that are hidden

Get-Mailbox | Where {$_.HiddenFromAddressListsEnabled -eq $True}

Open in new window


on my previous post I also forgot to include the filter to narrow down the list to only those with forwards

Get-Mailbox -Filter {ForwardingSmtpAddress -ne $null} | select UserPrincipalName,ForwardingSmtpAddress,DeliverToMailboxAndForward

Open in new window

Author

Commented:
Thanks for all of your help!!
Joshua GrantomSenior Systems Administrator
Top Expert 2014

Commented:
you're welcome!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial