Disable Clutter in Office 365


Microsoft turned on Clutter for all users in Exchange Online without proper notification or documentation of the consequences.  There is not a global option to turn Clutter on or off.  Clutter can only be disabled at the mailbox level using powershell or mail settings by the user. Another problem is that turning off clutter has very slow performance via powershell.



How to disable clutter via Office 365 OWA:

1. Login into Office 365 OWA.
2. Click the Settings Menu gear on the top right and select Options from the drop down.
3. Mail->Clutter, turn off the check box Separate items identified as clutter.


How to Disable Clutter via Powershell:

#Disable Office 365 Mailbox Clutter Powershell Script

$logOnly = $True

$cred = Get-Credential -UserName 'Office365GlobalAdmin@contoso.com' -Message 'Office 365 Administrator'

$errorlogfile = 'c:\temp\DisableClutterError.txt'

$logfile = 'c:\temp\DisableClutter.ps1'

Set-Content $logfile ""

Set-Content $errorlogfile ""

If ($logOnly)
    Add-Content $logfile '$cred = Get-Credential -UserName "Office365GlobalAdmin@contoso.com" -Message "Office 365 Administrator"'

    Add-Content $logfile '$logfile = "c:\temp\DisableClutter2.txt"'

    Add-Content $logfile 'Set-Content $logfile ""'

    Add-Content $logfile '$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri  -Credential $cred -Authentication Basic -AllowRedirection;'

    Add-Content $logfile 'Import-PSSession $Session'

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri  -Credential $cred -Authentication Basic -AllowRedirection;

Import-PSSession $Session
#modify the filter as needed or remove
$objUsers = Get-Mailbox -Filter { -not (userPrincipalName -like '*.onmicrosoft.com') } -ResultSize:Unlimited | select UserPrincipalName,SamAccountName,DistinguishedName
#$objUsers = Get-Mailbox -ResultSize:Unlimited | select UserPrincipalName, SamAccountName 
#Iterate through all users     
Foreach ($objUser in $objUsers) 
    #Prepare UserPrincipalName variable 
    $strUserPrincipalName = $($objUser.UserPrincipalName)
    #$strSamAccountName = $($objUser.SamAccountName)
    #$strDN = $($objUser.DistinguishedName)
    #write-host "Processing $strUserPrincipalName"
    #Get Clutter info to the users mailbox 
        $clutter = Get-Clutter -Identity $strUserPrincipalName
        $strClutterInfo = $clutter.isenabled
        #Sleep is to prevent micro delays from Microsoft slowly increasing
        Start-Sleep -milliseconds 3000
        if ($strClutterInfo -eq 'True')
            If ($logOnly)
                Write-Host "Logging Disable Clutter: $strUserPrincipalName"
                $pcmd = "Set-Clutter -Identity '$strUserPrincipalName' -Enable:`$false"
                #Write-Host $pcmd
                Add-Content $logfile $pcmd
                Add-Content $logfile 'Start-Sleep -milliseconds 3000'
                Write-Host "Disabling Clutter: $strUserPrincipalName"
                Set-Clutter -Identity $strUserPrincipalName -Enable:$false
                #Sleep is to prevent micro delays from Microsoft slowly increasing
                Start-Sleep -milliseconds 3000
        $ErrorMessage = $_.Exception.Message
        $FailedItem = $_.Exception.ItemName
        Write-Host "Error: $FailedItem $ErrorMessage"
        Add-Content $errorlogfile "Error: $FailedItem $ErrorMessage"

Remove-PSSession $Session;

If ($logOnly)
    Add-Content $logfile 'Remove-PSSession $Session;'







Running PowerShell cmdlets for large numbers of users in Office 365

Leave a Reply

%d bloggers like this: