🔧 New: User Management Graph PowerShell Toolkit

Simplify user tasks like bulk creation, updates, password resets, deletions, license checks & more — all from one place.

🚀 Launch Toolkit

Get-TransportRulePredicate: Explore Available Conditions and Exceptions in Exchange Online

Mail flow (transport) rules in Microsoft Exchange Online allow administrators to apply conditions and actions to messages for compliance, security, or custom business logic. To create these rules, you rely on predicates — which define the conditions and exceptions.

The Get-TransportRulePredicate cmdlet helps you discover and review all available predicates supported in your environment.

Note: Graph PowerShell does not support organization-level mail flow (transport) rule administration yet. For predicates, rules, and related configurations, you must use Exchange Online PowerShell.


Cmdlet Syntax

Get-TransportRulePredicate  [-Name ] []

Key Parameters:

  • -Name (optional): Lets you fetch details for a specific predicate.
  • CommonParameters: Like -Verbose, -Debug, etc.

By default, running the cmdlet without parameters lists all available predicates.


2) Usage Examples

Example 1: Fetch all Rule Predicates

Get-TransportRulePredicate

This lists every available predicate (condition/exception) in your tenant. Useful for reference when building or auditing transport rules.

Example 2: Fetch Predicate By Name and Format the Result

Get-TransportRulePredicate -Name SubjectMatches | Format-List

This retrieves details about the SubjectMatches predicate and formats the output for better readability. You’ll see what this predicate does and its parameters.

Example 3: Search Predicate By Name

Get-TransportRulePredicate | Where-Object {$_.Name -like "*Attachment*"}

This searches predicates whose names contain “Attachment.” Helpful for filtering predicates related to attachments.


3) Cmdlet Tips

  • Discovery-first approach: Before creating or modifying a transport rule, use this cmdlet to confirm whether the predicate you need is supported.
  • Exchange Online vs On-Prem: Predicate availability may differ between Exchange Online and Exchange Server on-premises. Always check in the environment where you’ll apply the rules.
  • Pair with Get-TransportRuleAction: Use both cmdlets together — one shows conditions/exceptions, the other shows actions — to build complete rules.
  • Naming convention: Predicates often use descriptive names (e.g., FromAddressContainsPredicate, SubjectMatchesPredicate) that align closely with their purpose.
  • Use with Format-List: For detailed inspection of a specific predicate’s properties, pipe output to Format-List.

4) Possible Errors & Solutions

Error Cause Solution
“The term ‘Get-TransportRulePredicate’ is not recognized …” You’re not connected to Exchange Online PowerShell or using the wrong module. Install and import the Exchange Online PowerShell V2 module (Install-Module ExchangeOnlineManagement), then run Connect-ExchangeOnline.
“A parameter cannot be found that matches parameter name …” Typo or unsupported parameter. Check syntax with Get-Help Get-TransportRulePredicate -Full.
“Cannot bind parameter ‘Name’ …” Invalid or misspelled predicate name. Verify the predicate exists by running Get-TransportRulePredicate first, then copy the exact Name.
Empty results when filtering Search criteria doesn’t match any predicate. Adjust your filter/wildcard (e.g., use *Attachment* instead of Attachment).

5) Conclusion

The Get-TransportRulePredicate cmdlet is an exploration tool for administrators. It reveals all available conditions and exceptions that can be used in mail flow (transport) rules within Exchange Online.

When planning new compliance or security rules:

  • Start by running Get-TransportRulePredicate to understand the available building blocks.
  • Pair with Get-TransportRuleAction to map conditions to actions.
  • Always confirm predicate availability in your environment since Exchange Online and on-premises may differ.

In short, this cmdlet ensures you know what’s possible before you implement mail flow rules.


Graph PowerShell Explorer Widget

20 Graph PowerShell cmdlets with easily accessible "working" examples.


Permission Required

Example:


                


                


                

© m365corner.com. All Rights Reserved. Design by HTML Codex