How do I find the shared mailbox with a specific forwarding activ?

I’m NOT very good to powershell yet, sorry for that, but I’m looking for powershell script that can search our shared mailbox for a specific mailforwarding. I have textfile with all sharedmailboxe that we will send a mail to. We want to find out if they still are active. Some has replied that it should not be deleted, but the sender is not the one we sent to. So I know the reply sender, but I don’t know the sharedmailbox that has forwarded to the sender.
Can someone help me with this?

a one liner to get all the mailboxes with forwarding address is below. You could put this in a loop and pass it the names of the shared mailboxes from your text file if you wanted to limit the results to your shared mailboxes on, and then pipe the results out to a file.

Get-mailbox | select DisplayName,ForwardingAddress | where {$_.ForwardingAddress -ne $Null}

Thank you for your answer, but I’m very sorry. I have no idea how to accomplish what you just mentioned.
Put this in a loop and pass it with the names of the shared mailboes? Could you help, please?

I do hope we are talking about the same. I’m interested to find the shared mailboxes where the “delivery options” is set on the Mail Flow in teh Exchange Admin Center.

get-content c:\mailaddresses.txt | Get-mailbox | select DisplayName,ForwardingAddress | where {$_.ForwardingAddress -ne $Null} | export-csv c:\results.csv -NoTypeInformation

This should export a list of mailboxes in your text document that have a forwarding address and save the results in c:\results.csv
Just change the path and name of your test file to what yours is and the results file to where you want the csv saved. I hope that is what you are after.

Hi Dkentoi,

Could you post an example of what you are trying to accomplish or find?

What Simon posted is a very handy way of looking for any mailbox which is forwarded.

Where {$_.ForwardingAddress -ne $Null}

The above filters for only the mailboxes which have a forwarding Address filled in.
Filters for any mailbox where the parameter Forwarding Address is not Null, empty.

And it will display the DisplayName of the mailbox, the friendly name as you will and the ForwardingAddress.

This way you can see to where whatever mailbox will forward.

When you go to EAC and search for a shared mailbox.
If you press on the “View Details” as shown in the link, you get delivery options.

Mailflow

@Simon

Thank you very much. It solved my request.

Of that 20 shared mailboxes only 2 showed forwardingadress and none of them was what I was looking for. So I manually went through all 20 mailboxes to find any smpt forwarding, I couldn’t find any. How can I find the shared mailbox that forwards the mail? Is there other option to setup forwarding?

Are you sure that you have a full list of shared mailboxes?

run and see if you come up with a different list

Get-Recipient -Resultsize unlimited | where {$_.RecipientTypeDetails -eq “SharedMailbox”}

you could possibly also find the mailbox that is forwarding to a specific email address with the following

get-mailbox -Filter { ForwardingAddress -like ‘theaddress where emails are being forwaded to’ } | select-object Name,ForwardingAddress

you could always check here as this has examples of listing all mailbox rules in an organisation.

https://emg.johnshopkins.edu/?p=77