NS News & Views

By Clive Norman
List all 33 articles

PowerShell to disable Clutter in Office 365

| Tags: PowerShell QuickTip SysAdmin Office 365

Most users of Office 365 will no doubt be aware of the Clutter folder; for the most part this Clutter folder works pretty well.

I’m not intending to go into the algorithmic processes of how the Clutter folder works, in this blog post - even if I could!

Despite this being a rather impressive addition to email functionality, it can unfortunately present problems for some users.  These issues can be anything from False - Positives to end users not fully understanding the process, and the requirement to check two folders (in order of priority).

Alas, it must also be said that in my experience, this latest addition to Outlook, has on occasion been used to conveniently claim non-receipt of email; the modern day version of “the dog ate my homework”.

Despite all end users having complete control of their Clutter functionality (to enable or disable), we have recognised a need to manage this centrally.

As such, after some Googling and script manipulating, we created three variants, allowing for centralised configuration of Clutter folders, via PowerShell.

Show me the code!

####Create an Office 365 session connection
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session


###Use this Powershell script to disable Clutter across all accounts
Get-Mailbox | Set-Clutter -Enable $true

###Use this PowerShell script to disable Clutter for an individual (in this example "PTest")
Set-Clutter -Identity PTest@YourDomain.com -Enable $false

###Use this PowerShell script to enumerate through an AD Group (in this example "Students")
$AllStudents = Get-DistributionGroupMember -Identity "students"
foreach ($Student in $AllStudents){
    Set-Clutter -Identity $Student.Identity -Enable $false
}


###Close Office 365 session connection
Remove-PSSession $Session