Last active
June 4, 2019 15:21
-
-
Save poiriersimon/85c5b7d0973c72ea4c730771080fb468 to your computer and use it in GitHub Desktop.
Estimate Exchange (Online) Transport rule size
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Help identify rule size for limit | |
# https://docs.microsoft.com/en-us/office365/servicedescriptions/exchange-online-service-description/exchange-online-limits#journal-transport-and-inbox-rule-limits | |
$TransportRules = Get-TransportRule | |
$Result = @() | |
Foreach($TransportRule in $TransportRules){ | |
if($Matches){$Matches.Clear()} | |
$RuleLength = 0 | |
$Regex = $TransportRule.Description -match "If the message:([\w\W]*)Take the following actions:" | |
if($Regex){ | |
$RuleLength+= $Matches[1].trim().Length | |
} | |
if($Matches){$Matches.Clear()} | |
$Regex = $TransportRule.Description -match "Except if the message:([\w\W]*)" | |
if($Regex){ | |
$RuleLength+= $Matches[1].trim().Length | |
} | |
$Rule = [PSCustomObject]@{ | |
Name = $TransportRule.Name | |
Priority = $TransportRule.Priority | |
State = $TransportRule.State | |
RuleLength = $RuleLength | |
} | |
$Result += $Rule | |
} | |
$Result |sort RuleLength -Descending |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment