For administrators managing an Exchange Online environment, maintaining visibility and control over email flow is paramount. The ability to inspect and manage the automated processes that handle messages before they reach a user's inbox is a critical security and organizational function. Exchange Online PowerShell provides a direct, scriptable interface to view these configurations, allowing for precise auditing and troubleshooting. This guide focuses specifically on how to utilize PowerShell cmdlets to view mailbox rules, ensuring your message hygiene policies are transparent and verifiable.
Understanding Mailbox Rules in Exchange Online
Mailbox rules, often referred to as inbox rules, are the building blocks of automated email management. These scripts run on the server side, applying actions to incoming messages based on specified conditions. Conditions might include specific senders, keywords in the subject, or message headers, while actions can move emails to folders, mark them as important, or even delete them. Because these rules execute outside the user's immediate awareness, it is essential for IT professionals to have a methodical way to view and validate them to prevent misrouted critical communications.
Prerequisites for Remote PowerShell Access
Before you can view mailbox rules, you must establish a remote PowerShell session connected to the Security & Compliance Center. This requires a global administrator or compliance administrator account with the necessary permissions. First, ensure that the Exchange Online PowerShell V2 module is installed on your administrative workstation. You will then use the `Connect-ExchangeOnline` cmdlet, which prompts for credentials and establishes the secure session required to execute administrative cmdlets against your tenant.

Connecting to Exchange Online
To initiate the connection, open Windows PowerShell and execute the following command. The system will launch a remote authentication process, typically redirecting you to a web portal to input your credentials securely. Once authenticated, the session remains active, allowing you to run subsequent commands without re-authenticating for the duration of the session.
Connect-ExchangeOnline
Viewing All Mailbox Rules with Get-InboxRule
The primary cmdlet for auditing is Get-InboxRule. This command retrieves all active mailbox rules defined for a specific user's mailbox. By default, when executed without parameters against a connection, it will list the rules for the currently connected account. To view the rules for another specific user, you must utilize the -Mailbox parameter, specifying the user's primary email address or alias. This is essential during audits where you need to verify the configuration of high-privilege accounts or departments.
Basic Command Syntax
The fundamental syntax for viewing all rules is straightforward. Running the cmdlet without filters returns a concise object list containing the rule name, description, and whether it is enabled. For a more comprehensive view of the conditions and actions applied to each rule, you can pipe the output to the Format-List cmdlet, which expands the properties to show the full logic tree of each regulation.

- View rules for the current user:
Get-InboxRule - View rules for a specific user:
Get-InboxRule -Mailbox "user@domain.com" - Detailed output:
Get-InboxRule -Mailbox "user@domain.com" | Format-List *
Analyzing Rule Properties and Conditions
When you view the detailed output of a mailbox rule, you are presented with a structured list of properties that define its behavior. Key properties to scrutinize include Name, RuleIdentity, Enabled, Conditions, and Actions. The Conditions section reveals the logic that triggers the rule, such as FromAddressContainsWords or SubjectContainsWords. The Actions section details what happens if the conditions are met, such as MoveToFolder or DeleteMessage. Understanding these properties allows you to determine if a rule is functioning as intended or if it conflicts with organizational policy.
Troubleshooting Disabled or Missing Rules
There are scenarios where a rule might not appear in the Get-InboxRule output. If you are certain a rule exists but the cmdlet returns nothing, the rule might be disabled. By default, Get-InboxRule only returns enabled rules. To include disabled rules in your audit, you must add the -IncludeHidden parameter. Furthermore, certain built-in rules are hidden from general view for stability. To ensure you are seeing every configuration, combine the -IncludeHidden switch with the detailed list format to verify the true state of the mailbox.
Command to Retrieve Hidden Rules
Use the following command to ensure your audit is comprehensive and does not overlook inactive configurations that could be re-enabled in the future.

Get-InboxRule -Mailbox "user@domain.com" -IncludeHidden | Format-Table Name, Enabled -AutoSize






















