skip to Main Content

Manage Clutter by using PowerShell | Office 365

Clutter is a new Exchange server feature that created for facilitating better and more efficient mailbox management by Exchange users. The Clutter feature is implemented by analyzing the Exchange mailbox data and based on a “learning process” and other algorithmic decides which of the mail items is “less important.”

The Clutter mechanism will relocate this “less important” mail items into the Clutter folder. The mail items are not deleted but instead, “removed” from the inbox mail folder and by doing so, enable users to focus solely on important mail items.

Clutter saves you time

Clutter by Microsoft moves less important emails out of your inbox and keeps you focused on what’s most important to you. Clutter is moving over one million emails per day and saves users 82 minutes per month on average.

Connect to Exchange Online PowerShell

To be able to run the PowerShell commands specified in the current article, you will need to Connect to Exchange Online PowerShell.

Start Windows PowerShell as administrator and run the cmdlet Connect-ExchangeOnline.

Connect-ExchangeOnline

1. Assign (Enable) Clutter for mailboxes or mailboxes

Enable clutter for a specific mailbox

PowerShell command syntax:

Set-Clutter -Identity -Enable $True

PowerShell command example:

Set-Clutter -Identity "John@o365info.com" -Enable $True

Enable Clutter for ALL mailboxes that don’t use Clutter (Bulk mode)

PowerShell command example:

$AllMailboxes = Get-MailBox -ResultSize Unlimited -Filter '(RecipientTypeDetails -eq "UserMailbox")' | Where-Object { (Get-Clutter -Identity $_.UserPrincipalName).IsEnabled -eq $False }

ForEach ($Mailbox in $AllMailboxes) {
    Set-Clutter -Identity $Mailbox.UserPrincipalName -Enable $True
}

Enable Clutter for ALL users mailboxes (Bulk mode)

PowerShell command example:

Get-Mailbox -ResultSize Unlimited | Set-Clutter -Enable $True

2. Display information about clutter settings

Display Clutter settings for a specific mailbox

PowerShell command syntax:

Get-Clutter -Identity | Select-Object IsEnabled,MailboxIdentity

PowerShell command example:

Get-Clutter -Identity "John@o365info.com" | Select-Object IsEnabled,MailboxIdentity

Display Clutter settings for ALL mailboxes (Bulk mode)

PowerShell command example:

$Results = @()

$AllMailboxes = Get-MailBox -Filter '(RecipientTypeDetails -eq "UserMailbox")'

ForEach ($Mailbox in $AllMailboxes) {

    $ClutterStatus = Get-Clutter -Identity $Mailbox.UserPrincipalName | Select-Object -ExpandProperty isEnabled
    $mailboxID = $Mailbox.UserPrincipalName
    $Properties = @{
        ClutterEnabled = $ClutterStatus
        Recipient      = $mailboxID
    }
    $Results += New-Object psobject -Property $properties
}

$Results | Select-Object Recipient,ClutterEnabled

Display mailboxes with Clutter Disabled

PowerShell command example:

$Results = @()

$AllMailboxes = Get-Mailbox -ResultSize Unlimited  | Where-Object { (Get-Clutter -Identity $_.alias).IsEnabled -eq $False }

ForEach ($Mailbox in $AllMailboxes) {

    $ClutterStatus = Get-Clutter -Identity $Mailbox.UserPrincipalName | Select-Object -ExpandProperty isEnabled
    $mailboxID = $Mailbox.UserPrincipalName
    $Properties = @{
        ClutterEnabled = $ClutterStatus
        Recipient      = $mailboxID
    }
    $Results += New-Object psobject -Property $properties
}
$Results | Select-Object Recipient,ClutterEnabled

Display mailboxes with Clutter Enabled

PowerShell command example:

$Results = @()

$AllMailboxes = Get-Mailbox -ResultSize Unlimited  | Where-Object { (Get-Clutter -Identity $_.alias).IsEnabled -eq $True }

ForEach ($Mailbox in $AllMailboxes) {

    $ClutterStatus = Get-Clutter -Identity $Mailbox.UserPrincipalName | Select-Object -ExpandProperty isEnabled
    $mailboxID = $Mailbox.UserPrincipalName
    $Properties = @{
        ClutterEnabled = $ClutterStatus
        Recipient      = $mailboxID
    }
    $Results += New-Object psobject -Property $properties
}
$Results | Select-Object Recipient,ClutterEnabled

Display Clutter folder with number of items and size

PowerShell command example:

$AllMailboxes = Get-Mailbox -ResultSize Unlimited  
ForEach ($Mailbox in $AllMailboxes) {
    ForEach-Object { Get-MailboxFolderStatistics –Identity $Mailbox.UserPrincipalName } | Where-Object { $_.Name –Like "Clutter" } | Format-List Identity, ItemsInFolder, FolderSize
}

3. Disable mailbox Clutter

Disable Clutter for a specific mailbox

PowerShell command syntax:

Set-Clutter -Identity -Enable $False

PowerShell command example:

Set-Clutter -Identity "John@o365info.com" -Enable $False

Disable clutter for ALL user mailboxes (Bulk mode)

PowerShell command example:

Get-Mailbox -ResultSize Unlimited | Set-Clutter -Enable $False

4. Export information about Clutter settings

Export Clutter settings for a specific mailbox to CSV file

PowerShell command example:

Get-Clutter -Identity "John@o365info.com" | Export-Csv "C:\TEMP\John Cluter settings.CSV" –NoTypeInformation -Encoding UTF8

PowerShell command example:

$Results = @()

$AllMailboxes = Get-MailBox -Filter '(RecipientTypeDetails -eq "UserMailbox")'

ForEach ($Mailbox in $AllMailboxes) {
    $ClutterStatus = Get-Clutter -Identity $Mailbox.UserPrincipalName | Select-Object -ExpandProperty isEnabled
    $mailboxID = $Mailbox.UserPrincipalName
    $Properties = @{
        ClutterEnabled = $ClutterStatus
        Recipient      = $mailboxID
    }
    $Results += New-Object psobject -Property $properties
    $ExportData = $Results
}
$Results | Select-Object Recipient,ClutterEnabled

$ExportData | Export-Csv "C:\TEMP\Clutter settings ALL mailboxes.CSV" –NoTypeInformation -Encoding UTF8

Export mailboxes with Clutter Disabled to CSV file

PowerShell command example:

Results = @()

$AllMailboxes = Get-Mailbox -ResultSize Unlimited  | Where-Object { (Get-Clutter -Identity $_.alias).IsEnabled -eq $False }

ForEach ($Mailbox in $AllMailboxes) {
    $ClutterStatus = Get-Clutter -Identity $Mailbox.UserPrincipalName | Select-Object -ExpandProperty isEnabled
    $mailboxID = $Mailbox.UserPrincipalName
    $Properties = @{
        ClutterEnabled = $ClutterStatus
        Recipient      = $mailboxID
    }
    $Results += New-Object psobject -Property $properties
    $ExportData = $Results
}
$Results | Select-Object Recipient,ClutterEnabled

$ExportData | Export-Csv "C:\TEMP\ALL mailboxes - Clutter Disabled.CSV" –NoTypeInformation -Encoding UTF8

Export mailboxes with Clutter Enabled to CSV file

Results = @()

$AllMailboxes = Get-Mailbox -ResultSize Unlimited  | Where-Object { (Get-Clutter -Identity $_.alias).IsEnabled -eq $True }

ForEach ($Mailbox in $AllMailboxes) {
    $ClutterStatus = Get-Clutter -Identity $Mailbox.UserPrincipalName | Select-Object -ExpandProperty isEnabled
    $mailboxID = $Mailbox.UserPrincipalName
    $Properties = @{
        ClutterEnabled = $ClutterStatus
        Recipient      = $mailboxID
    }
    $Results += New-Object psobject -Property $properties
    $ExportData = $Results
}
$Results | Select-Object Recipient,ClutterEnabled

$ExportData | Export-Csv "C:\TEMP\ALL mailboxes - Clutter Enabled.CSV" –NoTypeInformation -Encoding UTF8

Export Clutter folder number of items and size

$AllMailboxes = Get-Mailbox -ResultSize Unlimited  
$MailboxFolderStatisticsClutter =
ForEach ($Mailbox in $AllMailboxes) {
    ForEach-Object { Get-MailboxFolderStatistics –Identity $Mailbox.UserPrincipalName } | Where-Object { $_.Name –Like "Clutter" } | Format-List Identity, ItemsInFolder, FolderSize
}

$MailboxFolderStatisticsClutter | Export-Csv "C:\TEMP\Clutter Folder - Number of mail items and size.CSV" –NoTypeInformation -Encoding UTF8

5. Use Exchange Online rule to bypass Clutter

When using clutter option, the Exchange server who manages the user mailbox, “decide” according to an internal algorithm to “move” (or not to “move”) a specific E-mail message to the clutter folder.

In some scenarios, the clutter algorithm can decide to classify E-mail messages as an E-mail that will be sent to the clutter folder, and we would like to override this decision.

To be able to “inform” Exchange server that we would like to prevent that clutter process for specific mail items, we can create an Exchange Online rule.

The Exchange rule is implemented by, defining the characters of this specific emails, and asks from Exchange to add a specific mail field to the E-mail message header.

This special mail filed is named X-MS-Exchange-Organization-BypassClutter.

We will need to add this mail field, and set the value of this mail field to “true”

For example:

X-MS-Exchange-Organization-BypassClutter = true

If Exchange Server “locates” this mail field, it “understands” that it needs to Bypass the clutter process.

The Exchange rule can be created manually or via PowerShell.

In the following section, we review two examples of such an Exchange rule that will bypass the clutter of specific mail items.

Create Exchange rule that will bypass the clutter for E-mail that include a specific text in the mail SUBJECT

PowerShell command example:

New-TransportRule -Name -SubjectContainsWords "" -SetHeaderName "X-MS-Exchange-Organization-BypassClutter" -SetHeaderValue "true"

PowerShell command example:

New-TransportRule -Name "Bypass Clutter – Subject important" -SubjectContainsWords "important" -SetHeaderName "X-MS-Exchange-Organization-BypassClutter" -SetHeaderValue "true"

Create Exchange rule that will bypass clutter for E-mail that sent from a specific SENDER

PowerShell command syntax:

New-TransportRule -Name -From "" -SetHeaderName "X-MS-Exchange-Organization-BypassClutter" -SetHeaderValue "true"

PowerShell command example:

New-TransportRule -Name "Bypass Clutter – E-mail from Bob" -From Bob@o365info.com -SetHeaderName "X-MS-Exchange-Organization-BypassClutter" -SetHeaderValue "true"
The o365info Team

The o365info Team

This article was written by our team of experienced IT architects, consultants, and engineers.

This Post Has 2 Comments

  1. Hello,

    i have a specific requirement, i have few commands, that i have put together but i am not seeing the desired results. i am no genius when writing a script. it would be great if you can help me with this.

    i get the output of this,

    [String]$ExclusionGroupDN = (Get-DistributionGroup “Test Distribution list”).DistinguishedName
    Get-DistributionGroupMember $ExclusionGroupDN
    $ClutterDis = Get-Mailbox -Filter {MemberOfGroup -NotLike $ExclusionGroupDN } -ResultSize Unlimited | Where {$_.WhenCreated -gt(get-date).AddDays(-7)}.

    but when i add

    $ClutterDis=Get-Mailbox -ResultSize unlimited | Where-Object {$_.WhenCreated –gt ((Get-Date).Adddays(-7))} | Where-Object {(Get-Clutter -Identity $_.alias).IsEnabled -eq $True}

    thats when things dont work as they are expected. can this be modified to show only the items that have clutter enabled and are not a part of the distribution list that i am going to specify?

  2. Thank you!!! The PS menu script you wrote is perfect, and solved a number of my issues.

Leave a Reply

Your email address will not be published. Required fields are marked *