Updated 6th February 2013 to include Exchange 2013
Way back in 2005, the year when ExchangeInbox.com was started, I dedicated 3 articles discussing the anti-spam functionality provided in Exchange 2003.
Bringing Together the Exchange Anti-SPAM Cocktail
Enabling/Disabling the Junk Email Folder
Centralizing Junk Email Folder Administration
At the time I was encountering 10s of support problems most of which could be resolved with a better understanding of how the Exchange 2003 filtering worked. The most common problems revolved around the fact that the Exchange 2003 Intelligent Message Filter (IMF) and the Outlook client side filter were independent of each other.
To compound the confusion, there existed two switches for enabling the Junk Folder functionality. One enabled the Outlook client side filter move-to-Junk and the other enabled the server side (based on IMF SCL ratings) move-to-Junk operation.
The two switches have been inherited by subsequent Exchange 2007, 2010 and 2013 releases. Indeed the situation did not change much, except for one important detail i.e. the introduction of new cmdlets in Exchange 2010 that address the biggest pain point.
Note: These cmdlets are also included in Exchange 2013.
Junk Folder Enablement
Before moving further let make sure everyone understands what we are talking about. Asking you to read 3 articles is a little too much, however you should at least understand the issues discussed in Enabling/Disabling the Junk Email Folder. The points made for Exchange 2003, are also true for Exchange 2007, 2010 and 2013.
The most challenging aspect is the fact that the Junk Folder enablement switch is per mailbox. This automatically leads to the key question: How do I centrally enable/disable the Junk Folder for all mailboxes?
Since we are dealing with two filters this question has to be answered twice, once for each of:
- Outlook client-side junk filter
- Exchange server-side IMF/Content Filter
The solution for the Outlook client side junk filter was and continues to be very simple, use Group Policy. The tricky part has always been the enablement/disablement of the server side filter Junk Folder functionality. Indeed neither Exchange 2003 nor Exchange 2007 provided an out-of-the-box solution for managing this setting centrally. The options were to either log onto the mailboxes manually and set/clear the checkbox or get hold of some script that would do this operation for us in batch.
As for Exchange 2003 we answered these questions in Centralizing Junk Email Folder Administration.
Here are the scripts for Exchange 2003:
Glen's Exchange Dev Blog - Setting Outlook 2003 Junk Email Options Programmatically
Evan Dodds - IMF and the Junk E-mail folder in Outlook
...and Exchange 2007:
Glen's Exchange Dev Blog - Turning on Filter Junk Email in Exchange 2007 via an OWA Script
Exchange 2010/2013 MailboxJunkEmailConfiguration
As from Exchange 2010 this void was filled with the MailboxJunkEmailConfiguration cmdlets.
Turing on the Junk Folder for the User1 mailbox is simply a matter of entering this cmdlet at the Exchange Management Shell:
Set-MailboxJunkEmailConfiguration -Identity User1 -Enabled $true
...to disable it:
Set-MailboxJunkEmailConfiguration -Identity User1 -Enabled $false
And to enable it for all users in the specified Mailbox Database:
Get-Mailbox -Database <Mailbox Database Name> | Set-MailboxJunkEmailConfiguration -Enabled $true
Of course you can also use the Get-MailboxJunkEmailConfiguration to read the current settings.
Apart for managing the enablement switch, using these cmdlets we can also manage other per mailbox anti-spam settings such as the list of blocked and trusted senders. However I leave these for you to discover.
What about Set-OWAVirtualDirectory?
Before concluding it is worth mentioning another cmdlet, the Set-OWAVirtualDirectory. This was introduced in Exchange 2007 and many thought that its JunkEmailEnabled parameter could be used to control the Junk Folder enablement status. Unfortunately this was not the case. This cmdlet only controls the visibility of the Junk Email settings in OWA but does not change the actual settings.
Final Tips
Those of you who did not experience the pain of managing the Junk Folder enablement switch in Exchange 2003 and Exchange 2007 cannot fully appreciate why these new cmdlets deserved their own dedicated article. Many of us hoped to have this functionality in Exchange 2007. However we had to wait until Exchange 2010 to finally write a happy ending.
References
Bringing Together the Exchange Anti-SPAM Cocktail
Enabling/Disabling the Junk Email Folder
Centralizing Junk Email Folder Administration
Glen's Exchange Dev Blog - Setting Outlook 2003 Junk Email Options Programmatically
Evan Dodds - IMF and the Junk E-mail folder in Outlook
Glen's Exchange Dev Blog - Turning on Filter Junk Email in Exchange 2007 via an OWA Script
Exchange anti-spam myths revealed
Set-MailboxJunkEmailConfiguration
Get-MailboxJunkEmailConfiguration