Quantcast
Channel: Exchange Server 2013 - Mail Flow and Secure Messaging forum
Viewing all articles
Browse latest Browse all 3660

automation of transport rules creation - check message header fields

$
0
0

hi everybody,

i am trying to create another transport rule on an exchange server 2007 in powershell.

this rule is supposed to check the mail header for certain texts. in that case it should forward

the message as bcc. it is part of a bigger script to automate the creation of project mailboxes.

$short = "test_02"
$shortCollector = "test_02.collector"

  #create transport rule - >replyTo<

  $Condition1 = Get-TransportRulePredicate HeaderContains
  $mywords = @($short + "@mycompany")
  $mywords = $mywords + "cn=$short"

  $Condition1.messageHeader = @($mywords)
  $Action1 = Get-TransportRuleAction BlindCopyTo
  $ADOCollector = get-mailbox $shortCollector | select -expand userprincipalname
  $Action1.Addresses = @(get-mailbox $shortCollector)
  $RULE_name = $short + " out(replyTo)"
  New-TransportRule -name $RULE_name -Condition @($Condition1)  -Action @($Action1)   


it does not work as intended as i get another error like

...Cannot convert the "System.Object[]" value of type "System.Object[]" to type"Microsoft.Exchange.MessagingPolicies.Rules.Tasks.HeaderName".

any ideas how i can convert correctly?

thank you - best regards

marc


Viewing all articles
Browse latest Browse all 3660

Trending Articles