Managing Inbox Rules in Exchange Server 2010

by [Published on 3 June 2010 / Last Updated on 3 June 2010]

In this article we will manage Outlook Inbox rules from a centralized location using Exchange Management Shell.

Introduction

As a consultant, I have witnessed several directors and managers saying that they have something wrong with their Inbox. As Exchange Administrators we know that the guy must have created a messed up Inbox rule, however, it is always Exchange who gets the blame!

If we had the ability to manage users’ Inbox rules without going to their machine it would save a lot of time for the Help Desk team. Through Inbox Rules, you can have an Internal Application that requires some actions that you would rather not have to explain to all your users, and you can create an Inbox Rule for that specific application for everyone without any trouble.

Okay, so far I gave you a couple of scenarios where the Inbox rule management can be a pain, but if you are using Exchange Server 2010 then you have an easy solution for all these dilemmas. We can use Exchange Management Shell and a couple of Inbox Rule cmdlets to perform all those tasks in a few seconds!

Long story short, we will be able to create, delete, disable, and change Inbox Rules using PowerShell without interacting with the end users.

Understanding the Inbox Rules: Server-side and client-side...

An Inbox Rule can be a client-side or a server-side rule. A server-side rule can be performed without any requirement from the local machine, for example: change the importance of a message; move the incoming message to a specific folder on the User Mailbox; delete a message and so on.  The general rule is that all the components must be on the server side.

A client-side rule requires processing from the Outlook client, an example of a client-side rule is move specific messages identified by the rule to a PST folder. This rule cannot be processed at the server-level because the server is not able to work with a PST file on that context.

When you are creating rules in your Outlook and you chose some options that require a client-side rule, the Outlook will warn you about that, as shown in the Figure 1.


Figure 1

Why is it important to know the difference between Server and client side rules? When we manage Inbox Rules using Exchange Management Shell all client-side rules are removed.

Creating Rules using Outlook Web App and Outlook 2010…

Keeping on the same page, we are going to do a quick overview of how to manage Inbox rules using either Outlook Web App or Outlook 2010.

Using Outlook 2010 is really simple. To get to it, click on the Rules button located on the Home menu, and then click Manage Rules & Alerts… and all rules will be listed. If you have a client-side rule you will notice the string (client-only) at the end of your rule, as shown in Figure 2.


Figure 2

In order to manage the rules using Outlook Web App, we just need to click on Options on the right side, and then click Next.

Listing and retrieving information from the current Inbox rules…

We have seen how to create the rules using Outlook 2010 and Outlook Web App. Now, it is time to list all Inbox rules from a specific user using the Exchange Management Shell.

The cmdlet to list is Get-InboxRule, the syntax to list all rules form a specific user is:

Get-InboxRule –Mailbox <MailboxUser>

If you want to see a specific rule you can use

Get-InboxRule –Mailbox <MailboxUser> -Identity “<Rule-Name>”

Note:
Some rule names are created with the  “” character, in this situation you should use double-quote to reference the rule name.

If you want to just check the Inbox rules out from a user, you can use the following syntax:

Get-InboxRule –Mailbox <MailboxUser> | Select Name, Description | fl

The cmdlet above is shown in Figure 3, and you can just glance at the description to find out which rule you are looking for, instead of looking at all properties of a rule.


Figure 3

Changing an Inbox Rule

Let’s say our CEO has a rule that assigns a Blue Category when a message containing the word Payroll arrives on his mailbox, as shown in Figure 4. However, this morning he wants that the same message to be assigned to the Red Category and also marked as High Importance.

Figure 4

We have a couple of reasonable options: send a Help Desk and the poor guy will wait a little bit longer to find 10 seconds in the CEO agenda to fix the issue; try to establish a remote session; or just use this tutorial to get it done in a few seconds! :)

The option that takes the shortest amount of time without the need to face the CEO seems more attractive, isn’t it? Okay, let us use this one... First step is to find the Inbox Rule name as we saw in the previous section and also shown in Figure 5.


Figure 5

Now, let’s get the details of that specific Inbox rule, using the following cmdlet: Get-InboxRule –Mailbox Anderson -Identity “Subject contains ‘Payroll’” and in the Figure 6 we can see the attributes that we need to change which are ApplyCategory and MarkImportance.


Figure 6

Now that we know the values, let’s run the following cmdlet to change the Inbox Rule based on the request of our CEO, as follows:

Set-InboxRule -Mailbox Anderson -Identity "Subject contains 'Payroll'" -ApplyCategory {Red Category} -MarkImportance 2

Let’s do one more test, and we will be able to notice the difference after our changes, now the category is red and the message priority was changed to High, as shown in Figure 7.


Figure 7

Disabling and Removing Inbox Rules

We can disable and/or remove the users’ Inbox rules, let’s say that our CEO changed his mind again, and he doesn’t want any changes on messages containing the Payroll string. We can accomplish that just disabling the rule, we can use this following cmdlet can be used:

Disable-InboxRule -Mailbox Anderson -Identity "Subject contains 'Payroll'"

The results can be seen on the list of Inbox Rules of the user mailbox, as shown in the Figure 8.


Figure 8

If you want to remove the process is similar, just run the following syntax:

Remove-Inboxrule –Mailbox <MailboxName> -Identity “<Inbox Rule name>”

The cmdlet will ask for confirmation, just type in Y and it’s done. The cmdlet in action can be seen in the Figure 9.


Figure 9

When we try to disable and/or remove an Inbox Rule from a mailbox that has a client-side or disable rule, the following extra message will show up: Using Outlook Web App to modify your rules will delete any rules that were previously turned off using Outlook. If you want to preserve the rules you turned off using Outlook, click “No” and use Outlook to edit your rules. Are you sure you want to proceed? The reason for this message is what we explained in the last sentence of the introduction section. Any client-side rule will be removed when you change the Inbox Rule using Exchange Management Shell.

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'

We can use the same concept and create a rule to be applied to a specific group of users or all users. Let’s say that we want to configure the previous rule to all users, we just need to use the following cmdlet:

Get-Mailbox | foreach { New-InboxRule -Mailbox $_.Name -Name <InboxRuleName> -From <user@domain.org> -ApplyCategory 'Orange Category' -MarkImportance 'High' }

What results from our changes is that we just need to send a message using the account that we defined in the Form: field of the rule and the message will be categorized and importance as we defined. (Figure 10)


Figure 10

Bear in mind that if you run the script above all client-side rules will be removed. If you run that script to all users it means that you are removing all client-side rules from your network.

Conclusion

In this article we went through the process to manage Inbox Rules of our users from a central location. The Inbox rules have several items to be configured on this article we saw just a couple of them. Use your imagination and your company requirements to create your Inbox rules.

Featured Links