Transport rule inventory
Documentation: Microsoft Learn
Get-TransportRule returns every rule in the organization and the projection keeps the name with State, Mode, Priority, and Description.
The script
Script reader
Inspect before you run
Inspect the script below. It does not run in this browser.
Inspection only — no command has run.
Show reference output
Inspect this example’s structure
Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.
Get-TransportRule | Select-Object Name,State,Mode,Priority,Description- Stage 1Get-TransportRule
Positional values or no named parameters - Stage 2Select-Object
Positional values or no named parameters
How it works
Get-TransportRule returns every rule in the organization and the projection keeps the name with State, Mode, Priority, and Description. Priority is the evaluation order, and Mode says whether a rule enforces its action or is only auditing what it would have done.
Adapting it
Sort on Priority so the table reads in the order the service evaluates rules, which is how a conflict between two of them becomes obvious.
Requirements
ExchangeOnlineManagement module with a Connect-ExchangeOnline session.
If the result is unexpected
A transport-rule list does not explain why a message was handled unexpectedly.
Rule priority, enabled state, conditions and exceptions influence which actions apply.
- Inspect the relevant rule in priority order and compare its conditions with the message evidence.
Validate the result
The suspected rule's state and conditions account for the observed handling or are ruled out.
Keep the check reliable
Retain rule names, priorities and exceptions together in change reviews.