Simplify user tasks like bulk creation, updates, password resets, deletions, license checks & more — all from one place.
🚀 Launch ToolkitMail flow rules (a.k.a. transport rules) let you inspect messages in transit and take actions—redirect, add disclaimers, block, etc. Use Set-TransportRule to update existing rules in Exchange Online.
Set-TransportRule -Identity <RuleIdentity> -Name <String> [-Enabled <Boolean>] [-Priority <Int32>] [-SentTo <RecipientIdParameter[]>] [-SenderDomainIs <MultiValuedProperty>] [-SubjectContainsWords <MultiValuedProperty>]]
Get-TransportRule | Select Name, Identity
Set-TransportRule -Name "Redirect CEO Emails" `
-SentTo "samadmin@7xh7fj.onmicrosoft.com" `
-RedirectMessageTo kim@7xh7fj.onmicrosoft.com
Set-TransportRule -Name "Block Example.com Emails" `
-SenderDomainIs "example.com" `
-RejectMessageReasonText "Emails from gmail.com are not accepted."
Tip: If multiple rules share similar names, prefer -Identity over -Name to avoid ambiguity.
Connect-ExchangeOnline
Get-TransportRule | Sort-Object Priority | Select Name, Identity, Priority, Enabled
Set-TransportRule -Identity "" -Enabled $false -WhatIf
Get-TransportRule -Identity "" | Format-List *
Error | Cause | Solution |
---|---|---|
The transport rule 'X' can't be found. | Wrong -Identity or -Name not unique | Use `Get-TransportRule |
Parameter cannot be processed... (invalid recipient/domain) | Typo or object not resolvable | Validate recipients with Get-Recipient and verify domains are accepted/verified. |
Insufficient permissions | Missing Exchange role (e.g., Organization Management) | Ensure your account has appropriate Exchange Online admin roles. |
Rule updates not taking effect | Rule disabled or lower priority overshadowed by earlier rule | Confirm -Enabled $true and review/adjust -Priority. |
Conflicting conditions/actions | Mutually exclusive parameters used together | Check the rule’s current config with `Get-TransportRule -Identity " |
Localization in NDR text | Custom -RejectMessageReasonText unreadable for recipients | Keep messages concise, plain English (or provide localized variants via separate rules). |
Set-TransportRule is your go-to cmdlet for evolving mail flow policies without recreating rules. Always identify the exact rule via -Identity, test with -WhatIf, and be mindful of priority so your changes take effect as intended. For mail flow rule management, stick with Exchange Online PowerShell; Graph PowerShell remains limited to mailbox rules today.
If you’d like, I can draft a companion checklist (pre-change/post-change validation) or a rollback snippet to quickly restore previous settings.
© m365corner.com. All Rights Reserved. Design by HTML Codex