RSS

创建transport rule遭遇错误The sequence of predicates is invalid

28 Apr

本来要创建一个transport rule

代码如下:

$Condition = Get-TransportRulePredicate FromAddressContains
$Condition.words = @("externaluser1@gmail.com","externaluser2@gmail.com")
$Condition1 = Get-TransportRulePredicate SentTo
$Condition1.addresses = @(get-mailbox xunyang)
$Action = Get-TransportRuleAction DeleteMessage
New-TransportRule -Name "Deny Senders to Cellulardeals" -Condition @($Condition,$condition1) -Actions @($Action)

看起来是没有问题的吧

结果遭遇错误The sequence of predicates is invalid

换一下代码后(其实就是两个条件位置换了一下):

$Condition = Get-TransportRulePredicate SentTo
$Condition.addresses = @(get-mailbox xunyang)
$Condition1 = Get-TransportRulePredicate FromAddressContains
$Condition1.words = @("externaluser1@gmail.com","externaluser2@gmail.com")
$Action = Get-TransportRuleAction DeleteMessage
New-TransportRule -Name "Deny Senders to Cellulardeals" -Condition @($Condition,$condition1) -Actions @($Action)

ok了。

原因嘛:

还是transport rule比较傻,必须先得send to,然后才能from包含。如果你也遇到这个问题,没办法了,把步骤换一下就可以了。

Advertisements
 
 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: