I have searched around for this on google and I found the following cmd shell script
Get-Mailbox -Filter {ForwardingAddress -ne $null} | foreach {$recipient = $_; $forwardingsmtp = (Get-Recipient $_.ForwardingAddress).PrimarySmtpAddress; Write-Host $recipient.Name, $forwardingsmtp, $recipient.DeliverToMailboxAndForward }
however when I run it, it has some errors (pipeline not executed because a pipeline is already executing) , on the whole it works and gives me what I want, with the exception of the mailboxes where I get the error, I would however like to get it to work fully and export the result to a txt file if possible.
any help?