From: Luuke on
Just to add that I also did the test with the Default Exchange 2007
message classifications, same error message.

Thanks.

Luuke
From: Rich Matheisen [MVP] on
On Wed, 10 Feb 2010 23:19:14 -0800 (PST), Luuke <luuke57(a)gmail.com>
wrote:

>I have an error message :
>[PS] U:\>$Condition1 = get-transportrulepredicate From
>[PS] U:\>$Condition1.Addresses = @(get-mailbox "Luuke 57")
>[PS] U:\>$Exception = get-transportrulepredicate HasClassification
>[PS] U:\>$Exception.classification = @((get-messageclassification
>"CL1").Identity,(get-messageclassification "CL2").Identity)
>
>Exception setting "Classification": "Cannot convert "System.Object[]"
>to "Microsoft.Exchange.Data.Directory.ADObjectId"."
>At line:1 char:12
>+ $Exception.c <<<< lassification = @((get-messageclassification
>"CL1").Identity,(get-messageclassification "CL2").Identity)
>
>I added "Default\" before the classification name, I still get the
>same error. And Google did not help me a lot on that error :-(

Okay. Right church, wrong pew. Try this:

$Condition1 = get-transportrulepredicate From
$Condition1.Addresses = @(get-mailbox "Luuke 57")
$Exception1 = get-transportrulepredicate HasClassification
$Exception1.classification = (get-messageclassification
"CL1").Identity
$Exception2 = get-transportrulepredicate HasClassification
$Exception2.classification = (get-messageclassification
"CL2").Identity)

And then:
New-TransportRule ..... -Exceptions @($Exception1, $Exception2)
-Conditions @($Conditions) .....
---
Rich Matheisen
MCSE+I, Exchange MVP
From: Luuke on
Hi Rich,

Thanks for your help.

I believe we are close to find the solution ! The problem now is
another error message :
new-transportrule -name "Test Luuke" -Exceptions @($Exception1,
$Exception2) -Conditions @($Condition1) -Action @($Action1)

New-TransportRule : The sequence of predicates is invalid.
Parameter name: Exceptions
At line:1 char:18

(Nota :
$Action1 = get-transportruleaction RejectMessage
$Action1.RejectReason = "Missing Classification"
)

I did the following :
- switch the Exceptions sequence to @($Exception2, $Exception1), same
result
- put the Conditions before the Exceptions, same result

I do not see what other "predicate location change" I can do now...

Thanks !

Luuke
From: Rich Matheisen [MVP] on
On Tue, 16 Feb 2010 00:29:36 -0800 (PST), Luuke <luuke57(a)gmail.com>
wrote:

>I believe we are close to find the solution ! The problem now is
>another error message :
>new-transportrule -name "Test Luuke" -Exceptions @($Exception1,
>$Exception2) -Conditions @($Condition1) -Action @($Action1)
>
>New-TransportRule : The sequence of predicates is invalid.
>Parameter name: Exceptions
>At line:1 char:18
>
>(Nota :
>$Action1 = get-transportruleaction RejectMessage
>$Action1.RejectReason = "Missing Classification"
>)
>
>I did the following :
>- switch the Exceptions sequence to @($Exception2, $Exception1), same
>result
>- put the Conditions before the Exceptions, same result
>
>I do not see what other "predicate location change" I can do now...

Let's see the whole script that creates the bits and pieces of the
transport rule and the new-transportrule. Looking only at the error
isn't going to help much.
---
Rich Matheisen
MCSE+I, Exchange MVP
From: Luuke on
Here we go :

$Condition1 = get-transportrulepredicate From
$Condition1.addresses = @(get-mailbox "Luuke 57")
$Exception1 = get-transportrulepredicate HasClassification
$Exception1.classification = (get-messageclassification
"CL1").Identity
$Exception2 = get-transportrulepredicate HasClassification
$Exception2.classification = (get-messageclassification
"CL2").Identity
$Action1 = get-transportruleaction RejectMessage
$Action1.RejectReason = "Missing classification"
new-transportrule -name "Test" -Exceptions @($Exception1, $Exception2)
-Conditions @($Condition1) -Action @($Action1)

New-TransportRule : The sequence of predicates is invalid.
Parameter name: Exceptions
At line:1 char:18
+ new-transportrule <<<< -name "Test" -Exceptions @($Exception1,
$Exception2)
-Conditions @($Condition1) -Action @($Action1)

HTH.

Thanks.

Luuke