forward Distribution Group to a Mailbox with Filters

by jtmoney at 2013-02-01 06:24:15

Hi Guys,

This is my first post, hope it makes sense.
The task I have been given is to: forward a DG to a Mailbox but filter some of the mail to a different destination.
So: we have a DG (distribution Group) called ‘Support’ and we want to forward this to a MB (mailbox) called ‘Helpdesk’, but filter out some of this mail so it stays in Support. For example, if we wanted all mail to flow from support to helpdesk other than mail from gmail, could this be done with powershell?

by nate-n8 at 2013-02-01 11:06:36
you might want to look into Transport Rules
by Takuu at 2013-02-04 08:39:40
This can be done with powershell, but is probably easier to do in the GUI. I don’t make that many transport rules, so I don’t usually use Powershell for this. Here is the Powershell for what you are talking about though.
$Condition = Get-TransportRulePredicate SentToMemberOf
$Condition.Addresses = “
$Exception = Get-TransportRulePredicate FromAddressMatches
$Exception.Patterns = { }
$Action = Get-TransportRuleAction RedirectMessage
$Action.Addresses = ""
new-TransportRule -Name ‘DG Reroute’ -Comments ‘testing’ -Condition @($Condition) -Actions @($Action) -Exception @($Exception) -Enabled $true -Priority '3’
by jtmoney at 2013-02-05 02:40:35
On the advice of nate-n8, I have used a simple transport rule that as of yet does not work.
The rules states:
When a recipient address contains 'support’
Redirect the message to 'Helpdesk@…
Except when the from address contains 'Hotmail’

I thought this was simple enough except when i sent email to support from hotmail or gmail it ends up in support, where gmail should end up at helpdesk?

The powershell that TAKUU sent did not work either.

Any help

by jtmoney at 2013-02-05 04:00:50
I have managed to get a rule to work, but the difference is that the rule that works concerns a Universal Distribution group as oposed to a Universal Security group. If this is the issue, can you convert security groups to distribution groups?


by jtmoney at 2013-02-06 07:56:20
This code works and blocks gmail and btinternet from Helpdesk, but what I need is to block all mail from helpdesk other than gmail and btinternet

New-TransportRule -Name ‘SupportL’ -Comments ‘’ -Priority ‘0’ -Enabled $true -AnyOfToHeader ‘’ -RedirectMessageTo ‘’ -ExceptIfFromAddressContainsWords ‘gmail’,'btinternet’