Get All Users Outlook/Inbox Rules in Office 365
Get All Users Outlook/Inbox Rules in Office 365
Description: PowerShell cmdlet to view inbox rules is Get-InboxRule. First grab all mailboxes in the organisation and store the UserPrincipalName in a variable. Here we are storing it in a variable called “Users”
Then for each user we are going to get the InboxRule and select several attributes:
- MailboxOwnerID
- Name
- Description
- Enabled
- RedirectTo
- MoveToFolder
- ForwardTo
The entire list of attributes we can grab per mailbox is:
- Enabled
- Identity
- InError
- ErrorType
- Name
- Priority
- RuleIdentity
- SupportedByTask
- Legacy
- BodyContainsWords
- ExceptIfBodyContainsWords
- FlaggedForAction
- ExceptIfFlaggedForAction
- FromAddressContainsWords
- ExceptIfFromAddressContainsWords
- From
- ExceptIfFrom
- HasAttachment
- ExceptIfHasAttachment
- HasClassification
- ExceptIfHasClassification
- HeaderContainsWords
- ExceptIfHeaderContainsWords
- FromSubscription
- ExceptIfFromSubscription
- MessageTypeMatches
- ExceptIfMessageTypeMatches
- MyNameInCcBox
- ExceptIfMyNameInCcBox
- MyNameInToBox
- ExceptIfMyNameInToBox
- MyNameInToOrCcBox
- ExceptIfMyNameInToOrCcBox
- MyNameNotInToBox
- ExceptIfMyNameNotInToBox
- ReceivedAfterDate
- ExceptIfReceivedAfterDate
- ReceivedBeforeDate
- ExceptIfReceivedBeforeDate
- RecipientAddressContainsWords
- ExceptIfRecipientAddressContainsWords
- SentOnlyToMe
- ExceptIfSentOnlyToMe
- SentTo
- ExceptIfSentTo
- SubjectContainsWords
- ExceptIfSubjectContainsWords
- SubjectOrBodyContainsWords
- ExceptIfSubjectOrBodyContainsWords
- WithImportance
- ExceptIfWithImportance
- WithinSizeRangeMaximum
- ExceptIfWithinSizeRangeMaximum
- WithinSizeRangeMinimum
- ExceptIfWithinSizeRangeMinimum
- WithSensitivity
- ExceptIfWithSensitivity
- ApplyCategory
- ApplySystemCategory
- CopyToFolder
- DeleteMessage
- DeleteSystemCategory
- ForwardAsAttachmentTo
- ForwardTo
- MarkAsRead
- MarkImportance
- MoveToFolder
- PinMessage
- RedirectTo
- SendTextMessageNotificationTo
- StopProcessingRules
- MailboxOwnerId
- IsValid
- ObjectState
- RunspaceId
- Description
Finally, export the information to a CSV. The -Append parameter is necessary so it doesn’t overwrite the csv file as it moves onto the next mailbox.
PowerShell Script :
1
2
3
4
5
|
$users = (get-mailbox -resultsize unlimited).UserPrincipalName
foreach ($user in $users)
{
Get-InboxRule -Mailbox $user | Select-Object MailboxOwnerID,Name,Description,Enabled,RedirectTo, MoveToFolder,ForwardTo | Export-CSV C:tempInboxRule.csv -NoTypeInformation -Append
}
|
Categorised as: Exchange, Microsoft, Networking
Leave a Reply
You must be logged in to post a comment.