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 joe@gmail.com then we want to forward the email to jane@yahoo.com, then we would issue the followign command to accomplish that. First we create a new rule called forward joe@gmail.com to jane. Then we modity the joe@gmail.com to jane rule to forward properly.

New-InboxRule – mailbox userid -Name “Forward joe@gmail.com to jane” -MarkImportance high

Set-InboxRule -mailbox userid -identity “Forward joe@gmail.com to Jane” -FromAddressContainsWords {joe@gmail.com}

Set-InboxRule -mailbox userid -identity “Forward joe@gmail.com to Jane” -ForwardTo {jane@yahoo.com}

Disabling and Removing inbox Rules

To disable an inbox rule issue a command Disable-InboxRule

Diable-InboxRule -mailbox userid -identity “Forward joe@gmail.com to jane”

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

Remove-InboxRule -mailbox userid -identity “Forward joe@gmail.com to jane”

List of available Conditions you can use on your Rules.

Image

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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