Creating mailbox rules on Exchange Server 2010 using powershell

Listing and retrieving rules on current inbox users.

Get-inboxrule -mailbox userid

This will show all the server side rules on a given user

Get-inboxrule -mailbox userid -identity “RuleName” | fl

This command will show you the details of the rule.

Creating Inbox Rules

Besides changing and removing/disabling Inbox Rules we can also create Inbox rules using Exchange Management Shell. Let’s say that we want to configure any message coming from IT department to be configured to High importance and also to be assigned to the Orange category.

To create that rule for a single user, this following cmdlet can be used:

New-InboxRule -Mailbox anderson -Name ADM_ITRule -From it@apatricio.local -ApplyCategory ‘Orange Category’ -MarkImportance ‘High’

Modifying existing mailbox rules.

First we want to see how the current rule is set. For that we issue a command

Get-InboxRule -mailbox userid -identity “RuleName” | fl

Then we can modify the rules by using the Set-InboxRule command. For example, if we want to create a rule that says if the email from address contains word then we want to forward the email to, then we would issue the followign command to accomplish that. First we create a new rule called forward to jane. Then we modity the to jane rule to forward properly.

New-InboxRule – mailbox userid -Name “Forward to jane” -MarkImportance high

Set-InboxRule -mailbox userid -identity “Forward to Jane” -FromAddressContainsWords {}

Set-InboxRule -mailbox userid -identity “Forward to Jane” -ForwardTo {}

Disabling and Removing inbox Rules

To disable an inbox rule issue a command Disable-InboxRule

Diable-InboxRule -mailbox userid -identity “Forward to jane”

If you want to remove an inbox rule all together, use the command Remove-InboxRule.

Remove-InboxRule -mailbox userid -identity “Forward to jane”

List of available Conditions you can use on your Rules.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s