Find users that are auto forwarding / redirecting their email in Exchange 2010 using Powershell

69,194

Solution 1

You mean like

get-mailbox -Filter { ForwardingAddress -like '*' } | select-object Name,ForwardingAddress

? Or rather "Inbox rules" which your users would have created in Outlook or OWA? The latter should be trickier, but piping

$mbox = Get-Mailbox; $mbox | Foreach { Get-InboxRule -Mailbox $_ }

(Ryan, thanks for testing and correcting the syntax here) and doing some filtering on non-forwarding/redirecting rules should do the trick.

Solution 2

I found the following PowerShell commands helpful.

To find Forward Rules:

 foreach ($i in (Get-Mailbox -ResultSize unlimited)) { Get-InboxRule -Mailbox $i.DistinguishedName | where {$_.ForwardTo} | fl MailboxOwnerID,Name,ForwardTo >> d:\Forward_Rule.txt }

To find Redirect Rules:

 foreach ($i in (Get-Mailbox -ResultSize unlimited)) { Get-InboxRule -Mailbox $i.DistinguishedName | where {$_.ReDirectTo} | fl MailboxOwnerID,Name,RedirectTo >> d:\Redirect_Rule.txt }

Source: Microsoft TechNet Forums

Solution 3

Thanks for these commands.

Here's what I ended up using to find rules that wholesale forward or redirect...

foreach ($i in (Get-Mailbox -ResultSize unlimited)) { Get-InboxRule -Mailbox $i.DistinguishedName | where {$_.RedirectTo -or $_.ForwardTo -and -not ($_.description -match "If the message") } | fl MailboxOwnerId,Description >> rules.txt }

That's to find accounts that are basically using the mailbox as a relay to send everything to a different account. I thought it might be helpful to some.

Share:
69,194

Related videos on Youtube

Ryan H
Author by

Ryan H

I was the student tech at my High School, Running the Windows Server 2003 Domain and File Servers. On my own time, I played with Fedora Core for a bit. Then, coming to College, I became the administrator of the Computer Science department, and became familiar with Windows Server 2008 Active Directory, File Services, etc. This is where I gained my experience with Debian Linux (my preferred distro), and with routing and web technologies under Linux (dns, apache, dhcp, iptables). I use Cisco routers, but much prefer the procurve hardware from HP. I worked at Pacific Union College as the Network Security Specialist, dealing with various Windows Server technologies and Networking Infrastructure. Now I work for NWA Media, doing web development, primarily in Python.

Updated on September 18, 2022

Comments

  • Ryan H
    Ryan H almost 2 years

    We are using Live@edu, which is essentially hosted exchange server with some additional features and limitations to work around, and I'm trying to find everybody that is forwarding or redirecting emails from their accounts.

    I am trying to remove old accounts that have not been used, but we have instructions for users on redirecting emails, so we should expect that some users are indeed redirecting their emails, which will make their last login/logoff times not reflect whether they are indeed using auto forwarding or auto redirecting rules.

    How could I find a list of users with forwarding or redirection rules using Exchange 2010 Powershell Cmdlets?

    /EDIT: It may be sufficient for my purposes to find whether there are ANY server side rules, regardless of whether the rule forwards/redirects or does some other action.