Applies to: Exchange Server 2010 SP3, Exchange Server 2010 SP2

Topic Last Modified: 2012-11-19

Use the New-TransportRule cmdlet to create a transport rule that the Transport Rules agent uses when it processes e-mail messages that pass through the Hub Transport server or the Edge Transport server.

Important:
Transport rules created on Hub Transport servers are stored in Active Directory. All Hub Transport servers in an organization have access to the same set of transport rules. On Edge Transport servers, transport rules are saved in the local copy of Active Directory Lightweight Directory Services (AD LDS). Transport rules aren't shared or replicated between two Edge Transport servers or shared or replicated between Hub Transport servers and Edge Transport servers.

In Microsoft Exchange Server 2010, the transport rule cmdlets have been changed to allow easier creation of rules using the Exchange Management Shell. All rule predicates and actions are available for use directly with the New-TransportRule and Set-TransportRule cmdlets. In Exchange 2010, Get-TransportRulePredicate and Get-TransportRuleAction cmdlets are only used to enumerate the predicates and actions that are available for use on Hub Transport and Edge Transport servers.

Syntax

New-TransportRule -Name <String> [-ADComparisonAttribute <DisplayName | FirstName | Initials | LastName | Office | PhoneNumber | OtherPhoneNumber | Email | Street | POBox | City | State | ZipCode | Country | UserLogonName | HomePhoneNumber | OtherHomePhoneNumber | PagerNumber | MobileNumber | FaxNumber | OtherFaxNumber | Notes | Title | Department | Company | Manager | CustomAttribute1 | CustomAttribute2 | CustomAttribute3 | CustomAttribute4 | CustomAttribute5 | CustomAttribute6 | CustomAttribute7 | CustomAttribute8 | CustomAttribute9 | CustomAttribute10 | CustomAttribute11 | CustomAttribute12 | CustomAttribute13 | CustomAttribute14 | CustomAttribute15>] [-ADComparisonOperator <Equal | NotEqual>] [-AddManagerAsRecipientType <To | Cc | Bcc | Redirect>] [-AddToRecipients <RecipientIdParameter[]>] [-AnyOfCcHeader <RecipientIdParameter[]>] [-AnyOfCcHeaderMemberOf <RecipientIdParameter[]>] [-AnyOfRecipientAddressContainsWords <Word[]>] [-AnyOfRecipientAddressMatchesPatterns <Pattern[]>] [-AnyOfToCcHeader <RecipientIdParameter[]>] [-AnyOfToCcHeaderMemberOf <RecipientIdParameter[]>] [-AnyOfToHeader <RecipientIdParameter[]>] [-AnyOfToHeaderMemberOf <RecipientIdParameter[]>] [-ApplyClassification <String>] [-ApplyHtmlDisclaimerFallbackAction <Wrap | Ignore | Reject>] [-ApplyHtmlDisclaimerLocation <Append | Prepend>] [-ApplyHtmlDisclaimerText <DisclaimerText>] [-ApplyRightsProtectionTemplate <RmsTemplateIdParameter>] [-AttachmentContainsWords <Word[]>] [-AttachmentIsUnsupported <$true | $false>] [-AttachmentMatchesPatterns <Pattern[]>] [-AttachmentNameMatchesPatterns <Pattern[]>] [-AttachmentSizeOver <ByteQuantifiedSize>] [-BetweenMemberOf1 <RecipientIdParameter[]>] [-BetweenMemberOf2 <RecipientIdParameter[]>] [-BlindCopyTo <RecipientIdParameter[]>] [-Comments <String>] [-Confirm [<SwitchParameter>]] [-CopyTo <RecipientIdParameter[]>] [-DeleteMessage <$true | $false>] [-Disconnect <$true | $false>] [-DomainController <Fqdn>] [-Enabled <$true | $false>] [-ExceptIfADComparisonAttribute <DisplayName | FirstName | Initials | LastName | Office | PhoneNumber | OtherPhoneNumber | Email | Street | POBox | City | State | ZipCode | Country | UserLogonName | HomePhoneNumber | OtherHomePhoneNumber | PagerNumber | MobileNumber | FaxNumber | OtherFaxNumber | Notes | Title | Department | Company | Manager | CustomAttribute1 | CustomAttribute2 | CustomAttribute3 | CustomAttribute4 | CustomAttribute5 | CustomAttribute6 | CustomAttribute7 | CustomAttribute8 | CustomAttribute9 | CustomAttribute10 | CustomAttribute11 | CustomAttribute12 | CustomAttribute13 | CustomAttribute14 | CustomAttribute15>] [-ExceptIfADComparisonOperator <Equal | NotEqual>] [-ExceptIfAnyOfCcHeader <RecipientIdParameter[]>] [-ExceptIfAnyOfCcHeaderMemberOf <RecipientIdParameter[]>] [-ExceptIfAnyOfRecipientAddressContainsWords <Word[]>] [-ExceptIfAnyOfRecipientAddressMatchesPatterns <Pattern[]>] [-ExceptIfAnyOfToCcHeader <RecipientIdParameter[]>] [-ExceptIfAnyOfToCcHeaderMemberOf <RecipientIdParameter[]>] [-ExceptIfAnyOfToHeader <RecipientIdParameter[]>] [-ExceptIfAnyOfToHeaderMemberOf <RecipientIdParameter[]>] [-ExceptIfAttachmentContainsWords <Word[]>] [-ExceptIfAttachmentIsUnsupported <$true | $false>] [-ExceptIfAttachmentMatchesPatterns <Pattern[]>] [-ExceptIfAttachmentNameMatchesPatterns <Pattern[]>] [-ExceptIfAttachmentSizeOver <ByteQuantifiedSize>] [-ExceptIfBetweenMemberOf1 <RecipientIdParameter[]>] [-ExceptIfBetweenMemberOf2 <RecipientIdParameter[]>] [-ExceptIfFrom <RecipientIdParameter[]>] [-ExceptIfFromAddressContainsWords <Word[]>] [-ExceptIfFromAddressMatchesPatterns <Pattern[]>] [-ExceptIfFromMemberOf <RecipientIdParameter[]>] [-ExceptIfFromScope <InOrganization | NotInOrganization>] [-ExceptIfHasClassification <String>] [-ExceptIfHasNoClassification <$true | $false>] [-ExceptIfHeaderContainsMessageHeader <HeaderName>] [-ExceptIfHeaderContainsWords <Word[]>] [-ExceptIfHeaderMatchesMessageHeader <HeaderName>] [-ExceptIfHeaderMatchesPatterns <Pattern[]>] [-ExceptIfManagerAddresses <RecipientIdParameter[]>] [-ExceptIfManagerForEvaluatedUser <Sender | Recipient>] [-ExceptIfMessageTypeMatches <OOF | AutoForward | Encrypted | Calendaring | PermissionControlled | Voicemail | Signed | ApprovalRequest | ReadReceipt>] [-ExceptIfRecipientADAttributeContainsWords <Word[]>] [-ExceptIfRecipientADAttributeMatchesPatterns <Pattern[]>] [-ExceptIfRecipientAddressContainsWords <Word[]>] [-ExceptIfRecipientAddressMatchesPatterns <Pattern[]>] [-ExceptIfRecipientInSenderList <Word[]>] [-ExceptIfSCLOver <SclValue>] [-ExceptIfSenderADAttributeContainsWords <Word[]>] [-ExceptIfSenderADAttributeMatchesPatterns <Pattern[]>] [-ExceptIfSenderInRecipientList <Word[]>] [-ExceptIfSenderManagementRelationship <Manager | DirectReport>] [-ExceptIfSentTo <RecipientIdParameter[]>] [-ExceptIfSentToMemberOf <RecipientIdParameter[]>] [-ExceptIfSentToScope <InOrganization | NotInOrganization | ExternalPartner | ExternalNonPartner>] [-ExceptIfSubjectContainsWords <Word[]>] [-ExceptIfSubjectMatchesPatterns <Pattern[]>] [-ExceptIfSubjectOrBodyContainsWords <Word[]>] [-ExceptIfSubjectOrBodyMatchesPatterns <Pattern[]>] [-ExceptIfWithImportance <Low | Normal | High>] [-From <RecipientIdParameter[]>] [-FromAddressContainsWords <Word[]>] [-FromAddressMatchesPatterns <Pattern[]>] [-FromMemberOf <RecipientIdParameter[]>] [-FromScope <InOrganization | NotInOrganization>] [-HasClassification <String>] [-HasNoClassification <$true | $false>] [-HeaderContainsMessageHeader <HeaderName>] [-HeaderContainsWords <Word[]>] [-HeaderMatchesMessageHeader <HeaderName>] [-HeaderMatchesPatterns <Pattern[]>] [-LogEventText <EventLogText>] [-ManagerAddresses <RecipientIdParameter[]>] [-ManagerForEvaluatedUser <Sender | Recipient>] [-MessageTypeMatches <OOF | AutoForward | Encrypted | Calendaring | PermissionControlled | Voicemail | Signed | ApprovalRequest | ReadReceipt>] [-ModerateMessageByManager <$true | $false>] [-ModerateMessageByUser <RecipientIdParameter[]>] [-Organization <OrganizationIdParameter>] [-PrependSubject <SubjectPrefix>] [-Priority <Int32>] [-Quarantine <$true | $false>] [-RecipientADAttributeContainsWords <Word[]>] [-RecipientADAttributeMatchesPatterns <Pattern[]>] [-RecipientAddressContainsWords <Word[]>] [-RecipientAddressMatchesPatterns <Pattern[]>] [-RecipientInSenderList <Word[]>] [-RedirectMessageTo <RecipientIdParameter[]>] [-RejectMessageEnhancedStatusCode <RejectEnhancedStatus>] [-RejectMessageReasonText <RejectText>] [-RemoveHeader <HeaderName>] [-SCLOver <SclValue>] [-SenderADAttributeContainsWords <Word[]>] [-SenderADAttributeMatchesPatterns <Pattern[]>] [-SenderInRecipientList <Word[]>] [-SenderManagementRelationship <Manager | DirectReport>] [-SentTo <RecipientIdParameter[]>] [-SentToMemberOf <RecipientIdParameter[]>] [-SentToScope <InOrganization | NotInOrganization | ExternalPartner | ExternalNonPartner>] [-SetHeaderName <HeaderName>] [-SetHeaderValue <HeaderValue>] [-SetSCL <SclValue>] [-SmtpRejectMessageRejectStatusCode <RejectStatusCode>] [-SmtpRejectMessageRejectText <RejectText>] [-SubjectContainsWords <Word[]>] [-SubjectMatchesPatterns <Pattern[]>] [-SubjectOrBodyContainsWords <Word[]>] [-SubjectOrBodyMatchesPatterns <Pattern[]>] [-WhatIf [<SwitchParameter>]] [-WithImportance <Low | Normal | High>]

Detailed Description

The New-TransportRule cmdlet is used to create a new transport rule on a Hub Transport server or an Edge Transport server.

Transport rule conditions and exceptions use one or more predicates along with the corresponding values to test for. For a list of supported transport rule predicates, see Transport Rule Predicates.

Transport rules apply actions to messages, most with corresponding action values. For a list of supported transport rule actions, use the Get-TransportRuleActions cmdlet. For more details about transport rule actions, see Transport Rule Actions.

Important:
Although the Hub Transport and Edge Transport server roles share a set of common predicates and actions, some predicates and actions are exclusive to each server role.

For detailed information about how to create a new transport rule, see Create a Transport Rule. For information about transport rules and the Transport Rules agent, see Overview of Transport Rules.

You need to be assigned permissions before you can run this cmdlet. Although all parameters for this cmdlet are listed in this topic, you may not have access to some parameters if they're not included in the permissions assigned to you. To see what permissions you need, see the "Transport rules" entry in the Messaging Policy and Compliance Permissions topic.

Parameters

Parameter Required Type Description

Name

Required

System.String

The Name parameter specifies the display name of the transport rule to be created. The length of the name can't exceed 64 characters.

ADComparisonAttribute

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.ADAttribute

The ADComparisonAttribute parameter specifies an Active Directory attribute to compare. You can use one of the following Active Directory attributes:

  • DisplayName

  • FirstName

  • Initials

  • LastName

  • Office

  • PhoneNumber

  • OtherPhoneNumber

  • Email

  • Street

  • POBox

  • City

  • State

  • ZipCode

  • Country

  • UserLogonName

  • HomePhoneNumber

  • OtherHomePhoneNumber

  • PagerNumber

  • MobileNumber

  • FaxNumber

  • OtherFaxNumber

  • Notes

  • Title

  • Department

  • Company

  • Manager

  • CustomAttribute1 through CustomAttribute15

When specifying the ADComparisonAttribute parameter, if you don't specify a value for the ADComparisonOperator attribute, the default comparison operator Equal is used.

ADComparisonOperator

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Evaluation

The ADComparisonOperator parameter specifies a comparison operator for the ADAttributeComparison parameter. You can use the following values:

  • Equal

  • NotEqual

When specifying the ADComparisonOperator parameter, you must also specify the ADComparisonAttribute parameter.

AddManagerAsRecipientType

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.AddedRecipientType

The AddManagerAsRecipientType parameter adds the manager of the specified sender or recipient as an additional recipient of the message.

AddToRecipients

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The AddToRecipients parameter specifies an additional recipient for the message.

AnyOfCcHeader

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The AnyOfCcHeader parameter specifies a recipient to match the Cc SMTP message header. The rule is applied if the recipient specified is present as a Cc recipient.

AnyOfCcHeaderMemberOf

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The AnyOfCcHeaderMemberOf parameter specifies a distribution group. The rule is applied if a member of the specified distribution group is present as a Cc recipient.

AnyOfRecipientAddressContainsWords

Optional

Microsoft.Exchange.Data.Word[]

The AnyOfRecipientAddressContainsWords parameter specifies one or more words to check in a recipient address.

AnyOfRecipientAddressMatchesPatterns

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Pattern[]

The AnyOfRecipientAddressMatchesPatterns parameter specifies one or more regular expressions to match in a recipient address.

AnyOfToCcHeader

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The AnyOfToCcHeader parameter specifies a recipient to match in the To or Cc SMTP message headers. The rule is applied if the recipient specified is present as a To or Cc recipient.

AnyOfToCcHeaderMemberOf

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The AnyOfToCcHeaderMemberOf parameter specifies a distribution group. The rule is applied if a member of the specified distribution group is present as a To or Cc recipient.

AnyOfToHeader

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The AnyOfToHeader parameter specifies a recipient to match the To SMTP message header. The rule is applied if the specified recipient is present in the To header.

AnyOfToHeaderMemberOf

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The AnyOfToHeaderMemberOf parameter specifies a distribution group. The rule is applied if a member of the specified distribution group is present in the To header.

ApplyClassification

Optional

System.String

The ApplyClassification parameter specifies a message classification to apply to the message.

ApplyHtmlDisclaimerFallbackAction

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.DisclaimerFallbackAction

The ApplyHtmlDisclaimerFallbackAction parameter specifies an action to fall back to if the HTML disclaimer can't be applied to a message. You can use the following values:

  • Wrap

  • Ignore

  • Reject

Note:
This parameter is used with the ApplyHtmlDisclaimerText parameter. If this parameter isn't specified, the default fallback action is set to Wrap.

ApplyHtmlDisclaimerLocation

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.DisclaimerLocation

The ApplyHtmlDisclaimerLocation parameter specifies a location within the message where the HTML disclaimer text is inserted. You can use the following values:

  • Append

  • Prepend

Note:
This parameter is used with the ApplyHtmlDisclaimer parameter. If This parameter isn't specified, the default value of Append is used.

ApplyHtmlDisclaimerText

Optional

Microsoft.Exchange.Data.DisclaimerText

The ApplyHtmlDisclaimerText parameter specifies HTML disclaimer text. You must enclose the text in quotation marks ("). For more information, see Understanding Disclaimers.

ApplyRightsProtectionTemplate

Optional

Microsoft.Exchange.Configuration.Tasks.RmsTemplateIdParameter

The ApplyRightsProtectionTemplate parameter specifies the name of a rights policy template to apply to the message. This action adds rights protection to a message. To use this action, an Active Directory Rights Management Services (AD RMS) server should exist in the topology or the organization should be configured to use ILS.

For more information, see Understanding Transport Protection Rules.

AttachmentContainsWords

Optional

Microsoft.Exchange.Data.Word[]

The AttachmentContainsWords parameter specifies one or more words to check in an attachment. Only supported attachment types are checked.

AttachmentIsUnsupported

Optional

System.Boolean

The AttachmentIsUnsupported parameter instructs the rules agent to check for unsupported attachment types. Unsupported attachments are attachments for which an IFilter isn't installed on the Hub Transport server.

AttachmentMatchesPatterns

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Pattern[]

The AttachmentMatchesPatterns parameter specifies one or more regular expressions to match in a message attachment. Only supported attachment types are checked for the specified pattern.

AttachmentNameMatchesPatterns

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Pattern[]

The AttachmentNameMatchesPatterns parameter specifies a pattern to match attachment names with. The rule is applied if the name matches the specified pattern.

AttachmentSizeOver

Optional

Microsoft.Exchange.Data.ByteQuantifiedSize

The AttachmentSizeOver parameter specifies an attachment size. The rule is applied if the attachment size of a single attachment exceeds the specified size.

BetweenMemberOf1

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The BetweenMemberOf1 parameter specifies a distribution group. The rule is applied if the message is sent or received by a member of the specified distribution group.

This parameter is used with the BetweenMemberOf2 parameter.

BetweenMemberOf2

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The BetweenMemberOf2 parameter specifies a distribution group. The rule is applied if the message is sent to or received by a member of the specified distribution group.

This parameter is used with the BetweenMemberOf1 parameter.

BlindCopyTo

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The BlindCopyTo parameter specifies a recipient to add to the message as a Bcc recipient.

Comments

Optional

System.String

The Comments parameter is used to add informative comments to the rule, such as what the rule is used for or how it has changed over time. The length of the comment can't exceed 1024 characters.

Confirm

Optional

System.Management.Automation.SwitchParameter

The Confirm switch causes the command to pause processing and requires you to acknowledge what the command will do before processing continues. You don't have to specify a value with the Confirm switch.

CopyTo

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The CopyTo parameter specifies a recipient to add to the message as a Cc recipient.

DeleteMessage

Optional

System.Boolean

The DeleteMessage parameter specifies that the message be deleted.

Disconnect

Optional

System.Boolean

The Disconnect parameter instructs the rules agent to disconnect the SMTP session. This action is only available on the Edge Transport server.

DomainController

Optional

Microsoft.Exchange.Data.Fqdn

The DomainController parameter specifies the fully qualified domain name (FQDN) of the domain controller that writes this configuration change to Active Directory. The DomainController parameter isn't supported on the Edge Transport server role. The Edge Transport server role writes only to the Active Directory Lightweight Directory Services (AD LDS) instance.

Enabled

Optional

System.Boolean

The Enabled parameter specifies whether the transport rule should be enabled when it's created. The default value is $true.

ExceptIfADComparisonAttribute

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.ADAttribute

The ExceptIfADComparisonAttribute parameter specifies an Active Directory attribute to compare. Specify one of the Active Directory attributes listed in the ADComparisonAttribute parameter description.

ExceptIfADComparisonOperator

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Evaluation

The ExceptIfADComparisonOperator parameter specifies a comparison operator. Valid values include:

  • Equal

  • NotEqual

When specifying the ExceptIfADComparisonOperator parameter, you must also specify the ExceptIfADComparisonAttribute parameter.

ExceptIfAnyOfCcHeader

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The ExceptIfAnyOfCcHeader parameter specifies one or more recipients to match in the Cc header of a message.

ExceptIfAnyOfCcHeaderMemberOf

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The ExceptIfAnyOfCcHeaderMemberOf parameter specifies a distribution list.

ExceptIfAnyOfRecipientAddressContainsWords

Optional

Microsoft.Exchange.Data.Word[]

The ExceptIfAnyOfRecipientAddressContainsWords parameter specifies one or more words to check in a recipient address.

ExceptIfAnyOfRecipientAddressMatchesPatterns

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Pattern[]

The ExceptIfAnyOfRecipientAddressMatchesPatterns parameter specifies one or more regular expressions to match a recipient address.

ExceptIfAnyOfToCcHeader

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The ExceptIfAnyOfToCcHeader parameter specifies one or more recipients to match in the To or Cc headers of a message.

ExceptIfAnyOfToCcHeaderMemberOf

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The ExceptIfAnyOfToCcHeaderMemberOf parameter specifies a distribution group name. Recipients in the To and Cc headers are checked for membership of the specified group.

ExceptIfAnyOfToHeader

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The ExceptIfAnyOfToHeader parameter specifies one or more recipients to match in the To header of a message.

ExceptIfAnyOfToHeaderMemberOf

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The ExceptIfAnyOfToHeaderMemberOf parameter specifies one or more distribution groups. Recipients in the To header are checked for membership of the specified group.

ExceptIfAttachmentContainsWords

Optional

Microsoft.Exchange.Data.Word[]

The ExceptIfAttachmentContainsWords parameter specifies one or more words to check in an attachment. Only supported attachment types are checked.

ExceptIfAttachmentIsUnsupported

Optional

System.Boolean

The ExceptIfAttachmentIsUnsupported parameter specifies an exception for unsupported attachment types. Unsupported attachments are attachments for which an IFilter isn't installed on the Hub Transport server.

ExceptIfAttachmentMatchesPatterns

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Pattern[]

The ExceptIfAttachmentMatchesPatterns parameter specifies one or more regular expressions to match in a message attachment. Only supported attachment types are checked for the specified pattern.

ExceptIfAttachmentNameMatchesPatterns

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Pattern[]

The ExceptIfAttachmentNameMatchesPatterns parameter specifies one or more regular expressions to match attachment names with.

ExceptIfAttachmentSizeOver

Optional

Microsoft.Exchange.Data.ByteQuantifiedSize

The ExceptIfAttachmentSizeOver parameter specifies a byte-quantified size. Messages with attachments over the specified size are matched.

ExceptIfBetweenMemberOf1

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The ExceptIfBetweenMemberOf1 parameter specifies a distribution group to detect communication between members of two distribution groups. You must use this parameter with the ExceptIfBetweenMemberOf2 parameter.

ExceptIfBetweenMemberOf2

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The ExceptIfBetweenMemberOf2 parameter specifies a distribution group to detect communication between members of two distribution groups. You must use this parameter with the ExceptIfBetweenMemberOf1 parameter.

ExceptIfFrom

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The ExceptIfFrom parameter specifies one or more recipients. Messages sent by the specified recipient are matched.

ExceptIfFromAddressContainsWords

Optional

Microsoft.Exchange.Data.Word[]

The ExceptIfFromAddressContainsWords parameter specifies one or more words. If the From address contains a specified word, the rule doesn't apply.

ExceptIfFromAddressMatchesPatterns

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Pattern[]

The ExceptIfFromAddressMatchesPatterns parameter specifies one or more regular expressions to match in the sender's address.

ExceptIfFromMemberOf

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The ExceptIfFromMemberOf parameter specifies one or more distribution groups. Messages sent by members of the specified distribution group are matched.

ExceptIfFromScope

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.FromUserScope

The ExceptIfFromScope parameter specifies one of the following values:

  • InOrganization

  • NotInOrganization

  • ExternalPartner

  • ExternalNonPartner

For more information, see Transport Rule Predicates.

ExceptIfHasClassification

Optional

System.String

The ExceptHasClassification parameter specifies a message classification to check the message for.

ExceptIfHasNoClassification

Optional

System.Boolean

The ExceptIfHasNoClassification parameter specifies an exception for messages without a message classification.

ExceptIfHeaderContainsMessageHeader

Optional

Microsoft.Exchange.Data.HeaderName

The ExceptIfHeaderContainsMessageHeader parameter specifies a message header name to check. This parameter should be used with the ExceptIfHeaderContainsWords parameter.

ExceptIfHeaderContainsWords

Optional

Microsoft.Exchange.Data.Word[]

The ExceptIfHeaderContainsWords parameter specifies one or more words. The header specified in the ExceptIfHeaderContainsMessageHeader parameter is inspected for the specified words.

ExceptIfHeaderMatchesMessageHeader

Optional

Microsoft.Exchange.Data.HeaderName

The ExceptIfHeaderMatchesMessageHeader parameter specifies an SMTP header name to inspect. This parameter must be used with the ExceptIfHeaderMatchesPatterns parameter to specify a text pattern.

ExceptIfHeaderMatchesPatterns

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Pattern[]

The ExceptIfHeaderMatchesPatterns parameter specifies one or more regular expressions to match in the header value of the header specified in the ExceptIfHeaderMatchesHeader parameter.

ExceptIfManagerAddresses

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The ExceptIfManagerAddresses parameter specifies one or more recipients. The manager attribute of the evaluated user (sender or recipient, as specified in the ExceptIfManagerForEvaluedUser parameter) is matched with the specified recipients.

ExceptIfManagerForEvaluatedUser

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.EvaluatedUser

The ExceptIfManagerForEvaluatedUser parameter specifies whether the sender or recipient's manager attribute should be matched with recipients specified in the ExceptIfManagerAddresses parameter.

ExceptIfMessageTypeMatches

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.MessageType

The ExceptIfMessageTypeMatches parameter specifies a message type. Valid values are listed in the MessageTypeMatches parameter.

ExceptIfRecipientADAttributeContainsWords

Optional

Microsoft.Exchange.Data.Word[]

The ExceptIfRecipientADAttributeContainsWords parameter specifies one or more words to match in the specified Active Directory attribute of any recipient.

ExceptIfRecipientADAttributeMatchesPatterns

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Pattern[]

The ExceptIfRecipientADAttributeMatchesPatterns parameter specifies one or more text patterns to match in the recipient's Active Directory attribute. You must use this parameter with the ExceptIfADComparisonAttribute parameter to specify the attribute.

ExceptIfRecipientAddressContainsWords

Optional

Microsoft.Exchange.Data.Word[]

The ExceptIfRecipientAddressContainsWords parameter specifies one or more words to be matched in a recipient's address.

ExceptIfRecipientAddressMatchesPatterns

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Pattern[]

The ExceptIfRecipientAddressMatchesPatterns parameter specifies one or more text patterns to match in the recipient's address.

ExceptIfRecipientInSenderList

Optional

Microsoft.Exchange.Data.Word[]

This parameter applies to objects in the cloud-based service. It isn’t available for on-premises deployments.

This parameter is available for multi-tenant deployments. It isn't available for on-premises deployments. For more information about multi-tenant deployments, see Multi-Tenant Support.

The ExceptIfRecipientInSenderList parameter specifies an exception when a recipient is defined in a supervision list entry on the sender's mailbox. Supervision list entries perform the following functions:

  • They specify individual exceptions for the user in the closed campus supervision policy.

  • They identify the user as a victim in the anti-bullying policy.

To view the supervision list entries that are configured on a user's mailbox, run the Get-SupervisionListEntry command and specify the user's mailbox.

ExceptIfSCLOver

Optional

Microsoft.Exchange.Data.SclValue

The ExceptIfSCLOver parameter specifies a spam confidence level (SCL) value. The parameter matches messages with an SCL that's equal to or greater than the specified value. Valid values include a single integer from 0 through 9, or -1.

ExceptIfSenderADAttributeContainsWords

Optional

Microsoft.Exchange.Data.Word[]

The ExceptIfSenderADAttributeContainsWords parameter specifies one or more words to match in the specified Active Directory attribute of the sender.

ExceptIfSenderADAttributeMatchesPatterns

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Pattern[]

The ExceptIfSenderADAttributeMatchesPatterns parameter specifies one or more text patterns to match in the specified Active Directory attribute of the sender.

ExceptIfSenderInRecipientList

Optional

Microsoft.Exchange.Data.Word[]

This parameter applies to objects in the cloud-based service. It isn’t available for on-premises deployments.

This parameter is available for multi-tenant deployments. It isn't available for on-premises deployments. For more information about multi-tenant deployments, see Multi-Tenant Support.

The ExceptIfSenderInRecipientList parameter specifies an exception when the sender is defined in a supervision list entry on a recipient's mailbox. Supervision list entries perform the following functions:

  • They specify individual exceptions for the user in the closed campus supervision policy.

  • They identify the user as a victim in the anti-bullying policy.

To view the supervision list entries that are configured on a user's mailbox, run the Get-SupervisionListEntry command and specify the user's mailbox.

ExceptIfSenderManagementRelationship

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.ManagementRelationship

The ExceptIfSenderManagementRelationship parameter specifies the relationship to check for between the sender and the recipients. Valid values include:

  • Manager

  • DirectReport

ExceptIfSentTo

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The ExceptIfSentTo parameter specifies a recipient identity.

ExceptIfSentToMemberOf

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The ExceptIfSentToMemberOf parameter specifies a distribution group address.

ExceptIfSentToScope

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.ToUserScope

The ExceptIfSentToScope parameter specifies a message scope. Valid values include one of the following:

  • InOrganization

  • NotInOrganization

  • ExternalPartner

  • ExternalNonPartner

ExceptIfSubjectContainsWords

Optional

Microsoft.Exchange.Data.Word[]

The ExceptIfSubjectContainsWords parameter specifies one or more words to check for in the message subject.

ExceptIfSubjectMatchesPatterns

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Pattern[]

The ExceptIfSubjectMatchesPatterns parameter specifies one or more regular expressions to match in the message subject.

ExceptIfSubjectOrBodyContainsWords

Optional

Microsoft.Exchange.Data.Word[]

The ExceptIfSubjectOrBodyContainsWords parameter specifies one or more words to check for in the message subject or body.

ExceptIfSubjectOrBodyMatchesPatterns

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Pattern[]

The ExceptIfSubjectOrBodyMatchesPatterns parameter specifies one or more regular expressions to match in the message subject or the message body.

ExceptIfWithImportance

Optional

Microsoft.Exchange.Management.Tasks.Importance

The ExceptIfWithImportance parameter specifies message importance. Valid values include one of the following:

  • High

  • Low

  • Normal

From

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The From parameter specifies a sender. The rule is applied to messages received from the sender.

FromAddressContainsWords

Optional

Microsoft.Exchange.Data.Word[]

The FromAddressContainsWords parameter specifies one or more words to check for in the From address.

FromAddressMatchesPatterns

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Pattern[]

The FromAddressMatchesPatterns parameter specifies a pattern to match the From address with.

FromMemberOf

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The FromMemberOf parameter specifies a distribution group. The rule is applied to messages sent by members of the specified distribution group.

FromScope

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.FromUserScope

The FromScope parameter specifies a message scope to include. Valid values include the following:

  • InOrganization

  • NotInOrganization

  • ExternalPartner

  • ExternalNonPartner

Note:
The ExternalPartner value is a domain enabled for DomainSecure.

HasClassification

Optional

System.String

The HasClassification parameter specifies a message classification. The rule is applied to messages with the specified classification.

HasNoClassification

Optional

System.Boolean

The HasNoClassification parameter specifies that the rule be applied to messages which don't have a message classification. The value should be set to $true.

HeaderContainsMessageHeader

Optional

Microsoft.Exchange.Data.HeaderName

The HeaderContainsMessageHeader parameter specifies the SMTP header name to inspect. This parameter should be used with the HeaderContainsWords parameter.

HeaderContainsWords

Optional

Microsoft.Exchange.Data.Word[]

The HeaderContainsWords parameter specifies one or more words to match in the specified message header. You must use this parameter with the HeaderContainsMessageHeader parameter.

HeaderMatchesMessageHeader

Optional

Microsoft.Exchange.Data.HeaderName

The HeaderMatchesMessageHeader parameter specifies the header name to inspect for the specified text pattern. You must use this parameter with the HeaderMatchesPatterns parameter.

HeaderMatchesPatterns

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Pattern[]

The HeaderMatchesPatterns parameter specifies a pattern to match in the header specified by the HeaderMatchesMessageHeader parameter.

LogEventText

Optional

Microsoft.Exchange.Data.EventLogText

The LogEventText parameter specifies a message string to add to the event log entry created by the log event action. This action is only available on Edge Transport servers.

ManagerAddresses

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The ManagerAddresses parameter specifies a recipient. The rule is applied to messages where the specified recipient is the manager of the sender or the recipient (as specified in the ManagerForEvaluatedUser parameter).

ManagerForEvaluatedUser

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.EvaluatedUser

The ManagerForEvaluatedUser parameter specifies whether the sender or the recipient's manager should be evaluated. Use this parameter with the ManagerAddresses parameter.

MessageTypeMatches

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.MessageType

The MessageTypeMatches parameter specifies a message type. Valid values include:

  • OOF

  • AutoAccept

  • AutoForward

  • Encrypted

  • Calendaring

  • PermissionControlled

  • Voicemail

  • RSS

  • Signed

  • ApprovalRequest

  • ReadReceipt

ModerateMessageByManager

Optional

System.Boolean

The ModerateMessageByManager parameter specifies whether the message should be forwarded to the sender's manager for moderation. The default is $false. To enable moderation by the sender's manager, set the value to $true.

ModerateMessageByUser

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The ModerateMessageByUser parameter specifies a recipient to forward the message to for moderation.

Organization

Optional

Microsoft.Exchange.Configuration.Tasks.OrganizationIdParameter

This parameter is available for multi-tenant deployments. It isn't available for on-premises deployments. For more information about multi-tenant deployments, see Multi-Tenant Support.

The Organization parameter specifies the organization in which you'll perform this action. This parameter doesn't accept wildcard characters, and you must use the exact name of the organization.

PrependSubject

Optional

Microsoft.Exchange.Data.SubjectPrefix

The PrependSubject parameter specifies a string to add as a prefix to the message subject.

Note:
Consider ending the prefix string with a colon (:) and a space, or at least a space, to separate it from the original subject.

Priority

Optional

System.Int32

The Priority parameter specifies the order in which transport rules are applied. If you modify the priority of the rule, the position of the rule in the rule list changes to match the priority that you specified, and the Transport Rules agent increments all rules with a higher priority value. Rules with a lower priority value are processed first. The value of this parameter must be greater than or equal to 0.

Quarantine

Optional

System.Boolean

The Quarantine parameter instructs the rules agent to deliver the message to the quarantine mailbox specified in the Content Filtering configuration. This action is only available on Edge Transport servers.

RecipientADAttributeContainsWords

Optional

Microsoft.Exchange.Data.Word[]

The RecipientADAttributeContainsWords parameter specifies one or more words to check for in the specified Active Directory attribute of the recipient.

RecipientADAttributeMatchesPatterns

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Pattern[]

The RecipientADAttributeMatchesPatterns parameter specifies one or more patterns to match the value of the specified Active Directory attribute of the recipient with.

RecipientAddressContainsWords

Optional

Microsoft.Exchange.Data.Word[]

The RecipientAddressContainsWords parameter specifies one or more words to check for in the recipient's e-mail address.

RecipientAddressMatchesPatterns

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Pattern[]

The RecipientAddressMatchesPatterns parameter specifies a pattern to check the recipient's address for.

RecipientInSenderList

Optional

Microsoft.Exchange.Data.Word[]

This parameter applies to objects in the cloud-based service. It isn’t available for on-premises deployments.

This parameter is available for multi-tenant deployments. It isn't available for on-premises deployments. For more information about multi-tenant deployments, see Multi-Tenant Support.

The RecipientInSenderList parameter specifies the condition when a recipient is defined in a supervision list entry on the sender's mailbox. Supervision list entries perform the following functions:

  • They specify individual exceptions for the user in the closed campus supervision policy.

  • They identify the user as a victim in the anti-bullying policy.

To view the supervision list entries that are configured on a user's mailbox, run the Get-SupervisionListEntry command and specify the user's mailbox.

RedirectMessageTo

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The RedirectMessageTo parameter specifies that the message be redirected to the recipient specified as the value for this parameter.

RejectMessageEnhancedStatusCode

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.RejectEnhancedStatus

The RejectMessageEnhancedStatusCode parameter specifies an enhanced status code that's provided when rejecting messages. Valid values include 5.7.1 or from 5.7.1 through 5.7.999.

Note:
The transport rule can add a custom rejection message. To further customize the delivery status notification (DSN), you need to create a custom DSN message using the New-SystemMessage cmdlet. For more information, see Associate a DSN Message with a Transport Rule.

If an enhanced status code isn't specified, and only the RejectMessageReasonText parameter is used, the enhanced status code 5.7.1 is used.

RejectMessageReasonText

Optional

Microsoft.Exchange.Data.RejectText

The RejectMessageReasonText parameter specifies the rejection message provided upon message rejection.

Note:
The transport rule can add a custom rejection message. To further customize the DSN, you need to create a custom DSN message using the New-SystemMessage cmdlet. For more information, see Associate a DSN Message with a Transport Rule.

If a RejectMessageReasonText parameter isn't specified, and an enhanced status code is specified by using the RejectMessageEnchancedStatusCode parameter, the default reason text "Delivery not authorized, message refused" is used.

RemoveHeader

Optional

Microsoft.Exchange.Data.HeaderName

The RemoveHeader parameter specifies a header name to remove.

SCLOver

Optional

Microsoft.Exchange.Data.SclValue

The SCLOver parameter specifies an SCL value. The rule is applied to messages with an SCL that's equal to or higher than the value specified. Valid SCL values are an integer from 0 through 9, and -1.

SenderADAttributeContainsWords

Optional

Microsoft.Exchange.Data.Word[]

The SenderADAttributeContainsWords parameter specifies one or more words to match the sender's specified Active Directory attribute with.

SenderADAttributeMatchesPatterns

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Pattern[]

The SenderADAttributeMatchesPatterns parameter specifies one or more patterns to match the sender's specified Active Directory attribute with.

SenderInRecipientList

Optional

Microsoft.Exchange.Data.Word[]

This parameter applies to objects in the cloud-based service. It isn’t available for on-premises deployments.

This parameter is available for multi-tenant deployments. It isn't available for on-premises deployments. For more information about multi-tenant deployments, see Multi-Tenant Support.

The SenderInRecipientList parameter specifies the condition when the sender is defined in a supervision list entry on a recipient's mailbox. Supervision list entries perform the following functions:

  • They specify individual exceptions for the user in the closed campus supervision policy.

  • They identify the user as a victim in the anti-bullying policy.

To view the supervision list entries that are configured on a user's mailbox, run the Get-SupervisionListEntry command and specify the user's mailbox.

SenderManagementRelationship

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.ManagementRelationship

The SenderManagementRelationship parameter specifies a relationship between the sender and the recipient. Valid values include:

  • Manager

  • DirectReport

SentTo

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The SentTo parameter specifies a recipient. The rule is applied to messages matching the specified recipient.

SentToMemberOf

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The SentToMemberOf parameter specifies a distribution group. The rule is applied to messages where any recipient is a member of the specified group.

Note:
If the specified recipient isn't a distribution group, including conditions where the distribution group may have been removed after creation of the rule, no action is taken.

SentToScope

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.ToUserScope

The SentToScope parameter specifies a message scope. Valid values include:

  • InOrganization

  • NotInOrganization

  • ExternalPartner

  • ExternalNonPartner

For more information, see Transport Rule Predicates.

SetHeaderName

Optional

Microsoft.Exchange.Data.HeaderName

The SetHeaderName parameter specifies the name of an SMTP header to create or modify. You must use the SetHeaderValue parameter to specify the value.

SetHeaderValue

Optional

Microsoft.Exchange.Data.HeaderValue

The SetHeaderValue parameter specifies a value for the SMTP header specified in the SetHeaderName parameter.

SetSCL

Optional

Microsoft.Exchange.Data.SclValue

The SetSCL parameter modifies the SCL value of the message to the value specified. Valid SCL values can be a number from 0 through 9, or -1.

SmtpRejectMessageRejectStatusCode

Optional

Microsoft.Exchange.Data.RejectStatusCode

The SmtpRejectMessageRejectStatusCode parameter specifies an enhanced status code to provide when rejecting a message.

SmtpRejectMessageRejectText

Optional

Microsoft.Exchange.Data.RejectText

The SmtpRejectMessageRejectText parameter specifies a text string to add to the rejection message. You must use this parameter with the SmtpRejectMessageRejectStatusCode parameter.

SubjectContainsWords

Optional

Microsoft.Exchange.Data.Word[]

The SubjectContainsWord parameter specifies words to check the message subject for.

You can specify one or more words or phrases. When specifying more than one word or phrase, each word or phrase should be separated by a comma (,). When specifying a phrase that contains one or more spaces, you must enclose the phrase in quotation marks ("), for example:

Word1,"Phrase with spaces",word2.

SubjectMatchesPatterns

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Pattern[]

The SubjectMatchesPatterns parameter is used to specify text patterns to check the message subject for. For more details, see Regular Expressions in Transport Rules.

SubjectOrBodyContainsWords

Optional

Microsoft.Exchange.Data.Word[]

The SubjectOrBodyContainsWords parameter specifies words to check the message subject and body for. The rule is applied if any of the words or phrases specified is found in the message subject or body.

You can specify one or more words or phrases. When specifying more than one word or phrase, each word or phrase should be separated by a comma (,). When specifying a phrase with one or more spaces, you must enclose the phrase in quotation marks ("), for example:

Word1,"Phrase with spaces",word2.

SubjectOrBodyMatchesPatterns

Optional

Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Pattern[]

The SubjectOrBodyContainsPatterns parameter specifies text patterns to check the message subject and body for. The rule is applied if the word specified is found in the message subject or body. For more details, see Regular Expressions in Transport Rules.

WhatIf

Optional

System.Management.Automation.SwitchParameter

The WhatIf switch instructs the command to simulate the actions that it would take on the object. By using the WhatIf switch, you can view what changes would occur without having to apply any of those changes. You don't have to specify a value with the WhatIf switch.

WithImportance

Optional

Microsoft.Exchange.Management.Tasks.Importance

The WithImportance parameter specifies message importance. The rule is applied to messages matching the importance specified. Valid value includes one of the following:

  • High

  • Low

  • Normal

Input Types

To see the input types that this cmdlet accepts, see Cmdlet Input and Output Types. If the Input Type field for a cmdlet is blank, the cmdlet doesn’t accept input data.

Return Types

To see the return types, which are also known as output types, that this cmdlet accepts, see Cmdlet Input and Output Types. If the Output Type field is blank, the cmdlet doesn’t return data.

Examples

EXAMPLE 1

This example creates a transport rule on a Hub Transport server.

Copy Code
New-TransportRule -Name "ReportToManager" -FromMemberOf "Executives" -SentTo "AllCompany" -ApplyClassification "ExecutiveCommunication"

EXAMPLE 2

This example creates a transport rule on a Hub Transport server and applies the following conditions:

  • Between distribution list and distribution list   The first predicate property value for this condition is the distribution group Sales-Group. The second predicate property value for this condition is the distribution group Brokerage-Group.

The following exceptions are applied:

  • With text patterns in the subject   The value for this exception is Press Release or Corporate Communication.

  • From people   The values for this exception are the users Tony Smith and Pilar Ackerman.

The following actions will be applied to any messages that match the conditions that were described earlier, but don't match the "with text patterns in the subject" or "from people" exceptions:

  • Send reject message to sender   The value for this action is: E-mail messages sent between the Sales department and the Brokerage department are prohibited.

Copy Code
New-TransportRule "BlockMessagesBetweenSalesAndBrokerage" -BetweenMemberOf1 "Sales-Group" -BetweenMemeberOf2 "Brokerage-Group" -ExceptIfFrom "Tony Smith","Pilar Ackerman" -ExceptIfSubjectContainsWords "Press Release","Corporate Communication" -RejectMessageEnhancedStatusCode "5.7.1" -RejectMessageReasonText "E-mail messages sent between the Sales department and the Brokerage department are prohibited."