Skip to content

Instantly share code, notes, and snippets.

@poiriersimon
Last active June 4, 2019 15:21
Show Gist options
  • Save poiriersimon/85c5b7d0973c72ea4c730771080fb468 to your computer and use it in GitHub Desktop.
Save poiriersimon/85c5b7d0973c72ea4c730771080fb468 to your computer and use it in GitHub Desktop.
Estimate Exchange (Online) Transport rule size
#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