Get Inbox Rules

by Nuno Mota [Published on 18 April 2012 / Last Updated on 28 March 2012]

Using the Get-InboxRule cmdlet

Working with users’ mailbox rules has always been difficult. From an administrator perspective, you have three options to troubleshoot these:
1. give yourself FullAccess permissions to the user’s mailbox and use Outlook or OWA;
2. remote control the user’s machine;
3. use an Exchange Web Services script.

Now there is a new and easier option: the Get-InboxRule cmdlet. With it you can get details regarding any rule a user has set up on their Outlook or OWA clients.
Let’s look at an example. The following user has a rule called SCOM Alerts that moves any alerts from System Center Operations Manager to a specific folder. Using this cmdlet we can see exactly what the rule does:

[PS] C:\>Get-InboxRule "SCOM Alerts" -Mailbox user1 | FL
RunspaceId                            : 28080329-479c-476e-94fd-32bdaec13b05
Description                           : If the message:
                                            the message was received from 'OpsMgr@domain.com'
                                        Take the following actions:
                                            move the message to folder 'Alerts'
Enabled                               : True
Identity                              : domain.com/Users/User1\5030437392687824897
InError                               : False
Name                                  : SCOM Alerts
Priority                              : 3
RuleIdentity                          : 5030437392687824897
SupportedByTask                       : True
BodyContainsWords                     : {}
ExceptIfBodyContainsWords             : {}
FlaggedForAction                      :
ExceptIfFlaggedForAction              :
FromAddressContainsWords              : {}
ExceptIfFromAddressContainsWords      : {}
From                                  : {"OpsMgr@domain.com" [SMTP:OpsMgr@domain.com]}
ExceptIfFrom                          :
HasAttachment                         : False
ExceptIfHasAttachment                 : False
HasClassification                     :
ExceptIfHasClassification             :
HeaderContainsWords                   : {}
ExceptIfHeaderContainsWords           : {}
FromSubscription                      :
ExceptIfFromSubscription              :
MessageTypeMatches                    :
ExceptIfMessageTypeMatches            :
MyNameInCcBox                         : False
ExceptIfMyNameInCcBox                 : False
MyNameInToBox                         : False
ExceptIfMyNameInToBox                 : False
MyNameInToOrCcBox                     : False
ExceptIfMyNameInToOrCcBox             : False
MyNameNotInToBox                      : False
ExceptIfMyNameNotInToBox              : False
ReceivedAfterDate                     :
ExceptIfReceivedAfterDate             :
ReceivedBeforeDate                    :
ExceptIfReceivedBeforeDate            :
RecipientAddressContainsWords         : {}
ExceptIfRecipientAddressContainsWords : {}
SentOnlyToMe                          : False
ExceptIfSentOnlyToMe                  : False
SentTo                                :
ExceptIfSentTo                        :
SubjectContainsWords                  : {}
ExceptIfSubjectContainsWords          : {}
SubjectOrBodyContainsWords            : {}
ExceptIfSubjectOrBodyContainsWords    : {}
WithImportance                        :
ExceptIfWithImportance                :
WithinSizeRangeMaximum                :
ExceptIfWithinSizeRangeMaximum        :
WithinSizeRangeMinimum                :
ExceptIfWithinSizeRangeMinimum        :
WithSensitivity                       :
ExceptIfWithSensitivity               :
ApplyCategory                         : {}
CopyToFolder                          :
DeleteMessage                         : False
ForwardAsAttachmentTo                 :
ForwardTo                             :
MarkAsRead                            : False
MarkImportance                        :
MoveToFolder                          : Alerts
RedirectTo                            :
SendTextMessageNotificationTo         : {}
StopProcessingRules                   : False
MailboxOwnerId                        : domain.com/Users/User1
IsValid                               : True


In this case the rule basically looks for any e-mails coming from “OpsMgr@domain.com” and moves them to a folder called “Alerts” but this shows all the detail you get using this cmdlet.


Another good news is that you have all sort of cmdlets to work with these rules, from creating new rules to deleting existing ones:
- Disable-InboxRule
- Enable-InboxRule
- Get-InboxRule
- New-InboxRule
- Remove-InboxRule
- Set-InboxRule

Featured Links