Add a disclaimer to a message with a carriage return..

(**Be warned - this is not an interesting blog...)

Nevertheless there might be someone out there that desperately needs to know how to add a carriage return to a disclaimer through powershell...?  I was that person up to about half an hour ago.  The following transport rule adds a disclaimer to all outbound emails except for all outbound emails that already have the disclaimer (based on a unique piece of text in the original disclaimer). So if you reply to a reply to a external recipient you do not end up with multiple disclaimers.

In addition the disclaimer has a carriage return within the text of the disclaimer. This is done by adding `r to the disclaimer text.

So here it is:

$Condition1 = Get-TransportRulePredicate FromScope
$Condition1.Scope = "InOrganization"
$Condition2 = Get-TransportRulePredicate SentToScope
$Condition2.Scope = "NotInOrganization"
$Exception1 = Get-TransportRulePredicate SubjectorBodyContains
$Exception1.Words = @("thisisadulldisclaimerisntit")
$Action = Get-TransportRuleAction ApplyDisclaimer
$Action.Text = "This is a disclaimer with the unique text thisisadulldisclaimerisntit and a carriage return here `r and another one right here `r and this is the last line of this disclaimer"
$Action.Font = "Arial"
$Action.FontSize = "smaller"
$Action.FontColor = "gray"
New-TransportRule -Name "Append a disclaimer to all outbound emails" -Condition @($Condition1, $Condition2) -Exception @($Exception) -Action @($Action)

Half an hour well spent you'll agree..!