Retrieve all mailboxes where forwarding address is enabled

I was recently looking at retrieving all mailboxes where the forwarding address was enabled as part of the delivery options and to return the mailbox name, forwarding address and if the option to deliver message to both the forwarding address and mailbox is enabled and export this information to an output file.

I was able to do this by running the below in the Microsoft Exchange Management Shell:, by retrieving all mailboxes where the object ‘ForwardingAddress’ is not equal to null and by selecting the Name, ForwardingAddress and DeliverToMailboxAndForward objects and exporting to a CSV file.

Get-Mailbox | Where-Object {$_.ForwardingAddress -ne $null} | Select Name, ForwardingAddress, DeliverToMailboxAndForward | Export-CSV D:\Output\ForwardingAddresses.csv -NoTypeInformation