Transport rules with Mail Enabled Public Folder as destination

Exchange 2007 Management console doesn’t allow to use a mail-enabled public folder as a destination for transport rules, so the only way it’s make the rule from PowerShell.

In the following example we’ll create a Transport rule that sends a blind copy to a mail-enabled public folder for each message sent by a user.


$Mailbox = "user@example.local"
$PublicFolder = "\PF1\mailenabled-pf-01"
$condition = Get-TransportRulePredicate From
$condition.Addresses = @(( Get-Mailbox $Mailbox ))
$action = Get-TransportRuleAction BlindCopyTo
$action.Addresses = @(( Get-MailPublicFolder $PublicFolder ))
New-TransportRule -name "From $Mailbox Send A Bcc To $PublicFolder" -Conditions @($condition) -Actions @($action)

7 thoughts on “Transport rules with Mail Enabled Public Folder as destination

  1. Hello,

    i want to create a rule to say

    all e-mails from all users that send to an domain are stored in an public folder.

    it´s that tricky?

  2. Try with these lines:

    $Domain = “example.com”
    $PublicFolder = “\PF1\mailenabled-pf-01″
    $condition = Get-TransportRulePredicate AnyOfRecipientAddressMatches
    $condition.Patterns = @($Domain)
    $action = Get-TransportRuleAction BlindCopyTo
    $action.Addresses = @(( Get-MailPublicFolder $PublicFolder ))
    New-TransportRule -name “To Domain: $Domain Send A Bcc To $PublicFolder” -Conditions @($condition) -Actions @($action)

    This link could be useful too: http://technet.microsoft.com/en-us/library/bb691132.aspx

  3. Hi,
    Public Folder should be as member of Distribution Group, and Ditribution Group as TransportRule E-Mail target.
    But You can do it with Powerschell, it works.

  4. Hi,
    Your code works well, but I want to exclude the emails who come from inside addresses. I know that you can specify this in the gui. I have no idea how to fit this in a line of code.

    $exception = Get-TransportRulePredicate FromScope
    $exception.addresses = ???

  5. Pingback: .:Ewig Drohendes Versagen:.» Blogarchiv » Exchange 2007 Powershell

Leave a comment