Quick answer: Remove-InboxRule deletes an Inbox rule from an Exchange Online or Exchange Server mailbox. Name the mailbox and the rule:
Remove-InboxRule -Mailbox adelev@contoso.com -Identity "ProjectA-MoveToFolderA"
To delete every rule in the mailbox, pipe Get-InboxRule into it:
Get-InboxRule -Mailbox adelev@contoso.com | Remove-InboxRule
Warning: when you create, modify, remove, enable or disable an Inbox rule in Exchange PowerShell, any client-side rules created by Outlook are removed. That's why the cmdlet prompts you first.
Before you start
Connect. Run
Connect-ExchangeOnline(Exchange Online) or open the Exchange Management Shell (on-premises).Permissions. You need Exchange permissions assigned before you can run the cmdlet. Some parameters may be missing if your role doesn't include them.
List the rules first. Check names and identities with Get-InboxRule:
Get-InboxRule -Mailbox adelev@contoso.com | Format-Table Name, Enabled, RuleIdentity
Syntax
Remove-InboxRule
[-Identity] <InboxRuleIdParameter>
[-AlwaysDeleteOutlookRulesBlob]
[-Confirm]
[-DomainController <Fqdn>]
[-Force]
[-Mailbox <MailboxIdParameter>]
[-WhatIf]
[<CommonParameters>]
Parameters
| Parameter | What it does |
|---|---|
-Identity |
Required, position 1. The rule's name, its RuleIdentity, or MailboxAlias\RuleIdentity (Exchange Online) / MailboxCanonicalName\RuleIdentity (on-premises). Accepts pipeline input |
-Mailbox |
The mailbox that holds the rule: alias, email address, UPN, GUID and so on |
-AlwaysDeleteOutlookRulesBlob |
Hides the warning about Outlook client-side rules being removed |
-Force |
Hides warning and confirmation messages |
-Confirm |
Remove-* cmdlets prompt by default. -Confirm:$false skips the prompt |
-WhatIf |
Shows what would be removed without removing it |
-DomainController |
On-premises only. The domain controller to read from and write to, by FQDN |
Examples
Remove one rule
Remove-InboxRule -Mailbox adelev@contoso.com -Identity "ProjectA-MoveToFolderA"
If two rules share a name, use the RuleIdentity from Get-InboxRule instead:
Remove-InboxRule -Identity "adelev\16752869479666417665"
Preview first with -WhatIf
Get-InboxRule -Mailbox adelev@contoso.com | Remove-InboxRule -WhatIf
Nothing is deleted. PowerShell lists each rule it would remove.
Remove all rules in a mailbox
Get-InboxRule -Mailbox adelev@contoso.com | Remove-InboxRule
Add -Confirm:$false to skip the confirmation prompt in a script.
Remove forwarding rules from a compromised account
Microsoft lists Inbox rules that forward mail to unknown addresses, or move it to Notes, Junk Email or RSS Subscriptions, as common signs of a compromised mailbox. Find the forwarding rules, review them, then remove them:
$rules = Get-InboxRule -Mailbox adelev@contoso.com -IncludeHidden |
Where-Object { $_.ForwardTo -or $_.ForwardAsAttachmentTo -or $_.RedirectTo }
$rules | Format-List Name, Enabled, ForwardTo, ForwardAsAttachmentTo, RedirectTo
$rules | Remove-InboxRule -Confirm:$false
-IncludeHidden includes hidden Inbox rules in the results.
Remove rules by name pattern
Get-InboxRule -Mailbox adelev@contoso.com |
Where-Object { $_.Name -like "Old*" } |
Remove-InboxRule
Remove without the Outlook warning
Remove-InboxRule -Mailbox adelev@contoso.com -Identity "MoveReports" -AlwaysDeleteOutlookRulesBlob
This only hides the warning. Outlook client-side rules are still removed.
On-premises: pick a domain controller
Remove-InboxRule -Mailbox adelev@contoso.com -Identity "MoveReports" -DomainController dc01.contoso.com
Disable instead of delete
If you might want the rule back, turn it off with Disable-InboxRule. It takes the same parameters:
Disable-InboxRule -Mailbox adelev@contoso.com -Identity "MoveReports"
Disabling a rule in PowerShell still removes Outlook client-side rules.
Troubleshooting
- Rule not found, or two rules share the name. Check the name with
Get-InboxRule -Mailbox ..., then pass theRuleIdentityinstead of the name. - Outlook rules disappeared. That's documented behavior. Any Inbox rule change made in Exchange PowerShell removes client-side rules created in Outlook. Recreate them in Outlook.
- The rule comes back on a compromised account. Secure the account first, following Microsoft's compromised-account steps, then remove the rules.
- Parameter not found.
-DomainControllerexists only on-premises. Other missing parameters mean your role doesn't include them.
FAQ
What is AlwaysDeleteOutlookRulesBlob?
A switch that hides the warning shown when you change Inbox rules from PowerShell or Outlook on the web. It doesn't stop client-side rules from being removed.
Can I remove all Inbox rules at once?
Yes. Get-InboxRule -Mailbox adelev@contoso.com | Remove-InboxRule removes every rule in the mailbox.
Does Remove-InboxRule work in Exchange Online?
Yes. It works in Exchange Online and in Exchange Server 2010 through Exchange Server SE.
Can I undo Remove-InboxRule?
No. The rule is deleted. Run -WhatIf first, or use Disable-InboxRule if you may need the rule again.
Sources: Remove-InboxRule, Get-InboxRule, Disable-InboxRule and Responding to a compromised email account on Microsoft Learn.
Managing Microsoft 365 rooms too? Meeting Room 365 turns any tablet into a room display for Outlook and Teams calendars.