Skip to Content

[Solved] How to Configure Exchange Online Protection Malware Filter Policy to Block Documents based on File Extension

Problem: How to configure the malware scanner in Exchange Online Protection (EOP) to block non-executable document files such as pdfs, docs, and so on? On the interface can only add executables.

Exchange Online Protection Malware Filrer

Solution

Malware Filter within EOP cannot this in the UI but rather in PowerShell. Perform below steps to block file based on extension using PowerShell:

Step 1: Login using a Global Admin account to Exchange Online via Windows PowerShell (Run as Admin):

Set-ExecutionPolicy RemoteSigned -Scope Currentuser $credential = get-credential $ExchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid/" -Credential $credential -Authentication "Basic" -AllowRedirection Import-PSSession $ExchangeSession

Step 2: When you are prompted about changing the Execution Policy type A for Yes to All.

Step 3: Then modify this to include the extensions you want the block, for example the extensions must be in this format (separated by commas without spaces): “doc”,”docx”,”pdf” etc. Then when it is ready copy/paste it on the command line and press enter to execute:

Get-MalwareFilterPolicy -Identity default | select -Expand FileTypes; $FileTypesAdd += "pdf","doc","docx","xls"; Set-MalwareFilterPolicy -Identity default -EnableFileFilter $true -FileTypes $FileTypesAdd

Assumptions

  • That the policy is the default Malware Filter policy labeled “default”; and that
  • By performing this it will erase the previous list of executables so once this is complete simply log back into the UI and click the Add link, then select all to add all the executable extensions to your list. This way you will have all the executable and your new extensions in the list as desired.
  • If MFA (Multi-Factor Authentication) enabled on that account? you need to use the specific MFA password provided for apps when you first configured MFA.

Reference

Microsoft TechNet: Anti-spam and anti-malware protection in Office 365

Alex Lim is a certified IT Technical Support Architect with over 15 years of experience in designing, implementing, and troubleshooting complex IT systems and networks. He has worked for leading IT companies, such as Microsoft, IBM, and Cisco, providing technical support and solutions to clients across various industries and sectors. Alex has a bachelor’s degree in computer science from the National University of Singapore and a master’s degree in information security from the Massachusetts Institute of Technology. He is also the author of several best-selling books on IT technical support, such as The IT Technical Support Handbook and Troubleshooting IT Systems and Networks. Alex lives in Bandar, Johore, Malaysia with his wife and two chilrdren. You can reach him at [email protected] or follow him on Website | Twitter | Facebook

    Ads Blocker Image Powered by Code Help Pro

    Your Support Matters...

    We run an independent site that is committed to delivering valuable content, but it comes with its challenges. Many of our readers use ad blockers, causing our advertising revenue to decline. Unlike some websites, we have not implemented paywalls to restrict access. Your support can make a significant difference. If you find this website useful and choose to support us, it would greatly secure our future. We appreciate your help. If you are currently using an ad blocker, please consider disabling it for our site. Thank you for your understanding and support.