Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

3 Answers

up vote 5 down vote accepted

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.

share|improve this answer
    
Very useful, and something that I would have missed, but unfortunately not what I was asking for. I need to somehow look into the mailbox rules that might be created in Outlook or OWA to do forwarding. –  Ryan H Jun 22 '11 at 20:54
    
Ah, I was just typing an update to the answer to include the get-inboxrule hint. Unfortunately, I do not have an Exchange 2010 install handy until next week, so I can't do any testing of it by myself. –  the-wabbit Jun 22 '11 at 21:01
    
Has to be Get-Mailbox | Foreach { Get-InboxRule -Mailbox $_ }, because Get-InboxRule doesn't take Mailboxes as Pipeline input. Fix that and the check is yours. –  Ryan H Jun 23 '11 at 15:29
    
done, thank you. –  the-wabbit Jun 24 '11 at 7:08
    
I apologize. I forgot that multiple pipelines won't run, as I was going through a file. Needs to be like this: $mbox = Get-Mailbox; $mbox | Foreach { Get-InboxRule -Mailbox $_ }. –  Ryan H Jun 24 '11 at 19:40
add comment

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

share|improve this answer
add comment

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|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.