To export inbox rules in Exchange Online, run Get-InboxRule with -IncludeHidden for each mailbox in Exchange Online PowerShell and save the rules to a CSV file. Without -IncludeHidden, hidden rules are left out. The cmdlet does not work for the Global Reader role, so use an Exchange administrator.
| Method | Best fit |
|---|---|
| PowerShell | A CSV of every rule in every mailbox, with hidden, forwarding and deleting rules marked. |
| Admin centre | Finding who created or changed a rule, and when, from the audit log. |
| Altivane | Recommended for recurring reviews, with rules that send mail outside the organisation rated Critical. |
Before you start
Use an account in the Organization Management role group in Exchange Online, which the Exchange Administrator role in Microsoft Entra ID gives. The audit search in Option 2 needs the Audit Logs or View-Only Audit Logs role in Microsoft Purview.
The script reads 1 mailbox at a time, so a large tenant takes a while. The audit log keeps records for 180 days, or 1 year for users with an E5 licence. The examples read and export rules; they change nothing.
Option 1
Export inbox rules with PowerShell
Install the module once, then export every rule in every user and shared mailbox. Each mailbox is read with and without hidden rules, so the hidden ones can be marked.
# Install once, if the module is not already installed.
Install-Module -Name ExchangeOnlineManagement -Scope CurrentUser$ErrorActionPreference = 'Stop'
Connect-ExchangeOnline -ShowBanner:$false
try {
$types = 'UserMailbox', 'SharedMailbox'
$mailboxes = Get-EXOMailbox -ResultSize Unlimited -RecipientTypeDetails $types
$report = @(foreach ($mailbox in $mailboxes) {
$address = $mailbox.PrimarySmtpAddress
try {
$visible = @(Get-InboxRule -Mailbox $address | ForEach-Object { $_.RuleIdentity })
$rules = @(Get-InboxRule -Mailbox $address -IncludeHidden)
} catch {
Write-Warning "Skipped ${address}: $($_.Exception.Message)"
continue
}
foreach ($rule in $rules) {
$sends = @($rule.ForwardTo) + @($rule.ForwardAsAttachmentTo) + @($rule.RedirectTo)
$sendsTo = @($sends | Where-Object { $_ })
[pscustomobject]@{
Mailbox = $address
Rule = $rule.Name
Enabled = $rule.Enabled
Hidden = $rule.RuleIdentity -notin $visible
Forwards = $sendsTo.Count -gt 0
SendsTo = $sendsTo -join '; '
Deletes = [bool]($rule.DeleteMessage -or $rule.SoftDeleteMessage)
MoveToFolder = $rule.MoveToFolder
MarkAsRead = $rule.MarkAsRead
Description = ($rule.Description -replace '\s+', ' ').Trim()
}
}
})
if ($report.Count -eq 0) {
Write-Output 'No inbox rules were found in user or shared mailboxes.'
} else {
$report | Sort-Object Mailbox, Rule |
Export-Csv -Path './inbox-rules.csv' -NoTypeInformation -Encoding utf8
$flagged = @($report | Where-Object { $_.Hidden -or $_.Forwards -or $_.Deletes })
Write-Output "$($report.Count) rules exported, $($flagged.Count) to review first."
}
} finally {
Disconnect-ExchangeOnline -Confirm:$false
}The CSV has 1 row per rule. Forwards covers forwarding, forwarding as an attachment and redirecting, with SendsTo saying where. A rule that moves mail to Junk Email or RSS Subscriptions, a common sign of a compromised mailbox, shows in MoveToFolder. Add 'RoomMailbox' to $types to widen the export. A mailbox Exchange will not read is skipped with a warning.
Check a single mailbox
Reconnect with Connect-ExchangeOnline first: the export above disconnects when it finishes.
# Run while connected to Exchange Online. Replace the example mailbox.
Get-InboxRule -Mailbox 'person@example.com' -IncludeHidden |
Format-List Name,Enabled,RedirectTo,Forward*,DeleteMessage,MoveToFolder,IdentityA nonblank RedirectTo, ForwardTo or ForwardAsAttachmentTo means the rule sends mail on.
Option 2
Find inbox rule changes in the Purview portal
- Sign in to the Microsoft Purview portal for the correct tenant.
- Select Audit. If it is not shown, select View all solutions and find Audit under Core.
- On the Search page, set Date and time range (UTC) to the period to check, up to 180 days.
- In Activities - operations names, enter
New-InboxRule,Set-InboxRule,UpdateInboxRules, then select Search. - When the search shows Completed, open it and select a record.
ObjectIdnames the mailbox and rule,Parametersholds its conditions and actions, andUserIdis who made the change. - Select Export to save the results as a CSV file.
The portal keeps each search in its list for 30 days; to remove yours, select it and select Delete.
This suits finding who made a rule and when. It does not list the rules a mailbox holds now: a rule made before the period searched does not appear, and records for users without an E5 licence can be missing.
Option 3 ยท Recommended for recurring reviews
Report on inbox rules with Altivane
- Open Altivane and choose the tenant.
- Run the Inbox Rules report.
- Open the tenant's Excel workbook and find the Inbox rules sheet. Rules rated Critical are listed first.
- Read the Not read sheet, when there is one, for any mailbox whose rules Exchange would not give.
The report keeps the rules that forward, redirect or delete mail, or move it to RSS, Conversation History, Archive or Junk Email, and rates each. An enabled rule sending mail outside the accepted domains is Critical. A rule that hides or deletes mail and marks it read, or whose name has no letters or digits, is Warning. A mailbox that could not be read is listed, never counted as having no rules. The report does not read hidden rules; use the script for those.
Contact usCommon questions
Why does Get-InboxRule fail for a Global Reader account?
Microsoft does not let the Global Reader role or the View-Only Organization Management role group run it. Use an account in Organization Management, or check which roles hold the cmdlet in your tenant with Get-ManagementRole -Cmdlet Get-InboxRule.
Why is a rule in the export but not in the person's Outlook?
A rule made in Outlook on the web or the new Outlook with some actions, such as marking a message as read, does not appear in classic Outlook's Rules and Alerts, yet it still runs. Check it in Outlook on the web.
Does this find mailbox forwarding too?
No. Forwarding set on the mailbox itself is a separate setting. See how to find mailbox forwarding.
Microsoft references
Technical references checked on 24 October 2026. The example scripts have been reviewed and syntax checked; they have not been run against a live tenant.
- Get-InboxRule reference
- Respond to a compromised cloud email account
- Permissions in Exchange Online
- Find the permissions required to run any Exchange cmdlet
- Search the audit log
- Search the audit log to investigate common support issues
- Inbox rule in Outlook on the web doesn't appear in Outlook for Windows