How to turn on zero-hour auto purge for malware

Turn on zero-hour auto purge in the default anti-malware policy.

Every Microsoft 365 security check · Threat Protection · NL-EXO-133

What this check looks at

Checks zero-hour auto purge is on in the default anti-malware policy, so an attachment found to be malware after delivery is taken out of the mailbox.

The default anti-malware policy scans every attachment as it arrives. Zero-hour auto purge for malware goes further: when an attachment already delivered is later found to be malware, it removes that message from the mailbox and puts it in quarantine.

The check reads the default anti-malware policy and passes when the purge is on. It fails when it is off, and reports not checked when the policy or the setting was not returned.

Why it matters

New malware is often only recognised after the first copies have been delivered. Without the purge those copies stay in the inbox, and the person who opens one later is infected by a file Microsoft already knows is malicious.

New malware is often only recognised once it has been seen a few times, after the first copies have been delivered. Without the purge, the attachment sits in the inbox until someone opens it, even though Microsoft by then knows exactly what it is.

The purge is on by default and has no cost to keep on: it acts only on attachments found to be malicious, and the message goes to quarantine, where an administrator can see what was removed and from whom.

How to fix it

Where: Microsoft Defender portal → Email & collaboration → Policies & rules → Threat policies → Anti-malware

Before you start

  • Nothing to prepare: the purge acts only on attachments Microsoft later finds to be malware.

Step by step

  1. See the setting. Connect with Connect-ExchangeOnline and run Get-MalwareFilterPolicy | Format-Table Name, IsDefault, ZapEnabled to see the purge setting of each anti-malware policy.
  2. Turn the purge on. In the Defender portal open Email & collaboration → Policies & rules → Threat policies → Anti-malware, open the default policy and tick Enable zero-hour auto purge for malware. Or run Set-MalwareFilterPolicy -Identity Default -ZapEnabled $true.
  3. Check the other policies. If other anti-malware policies apply to some people, turn the purge on in each of them too, with the same setting or Set-MalwareFilterPolicy and that policy’s name.
  4. Confirm the setting. Run the command from the first step again and check ZapEnabled is True. The next assessment passes.

With PowerShell

Set-MalwareFilterPolicy -Identity Default -ZapEnabled $true

What users will notice

An attachment found to be malware after delivery is moved to quarantine, out of the mailbox.

How to confirm it worked

Get-MalwareFilterPolicy -Identity Default | Format-List ZapEnabled shows True.

Frameworks and controls

This check maps to controls in 13 frameworks. Passing it is evidence that the setting is in place, not a certification against any of them.

The frameworks and controls NL-EXO-133 maps to
FrameworkControl
NCSC CAFB4.b Secure configuration
DSPTStandard 9: IT protection
NIS2Art. 21(2)(e) Security in acquisition, development and maintenance, including vulnerability handling
Microsoft Cloud Security BenchmarkES-2 Use modern anti-malware software
Zero TrustApplications
SOC 2CC6.8 Preventing or detecting unauthorised or malicious software
PCI DSS 4.0.15.2.1 An anti-malware solution is deployed on all system components
NIST SP 800-1713.14.2 Provide protection from malicious code
CMMC Level 2SI.L2-3.14.2 Malicious Code Protection
ISO 27001:2022A.8.7 Protection against malware
CIS Controls v8.19.7 Deploy and maintain email server anti-malware protections (IG3)10.1 Deploy and maintain anti-malware software (IG1)
NIST CSF 2.0RS.MI-01: Incidents are contained
NCSC 10 StepsArchitecture and configurationIncident management

The framework mappings were last checked against the published standards in October 2026.

Microsoft’s documentation

The full Microsoft 365 security checklist, worst first

ConfigCheckup

Check this in every tenant.

ConfigCheckup runs this check on every tenant you connect and gives you a step-by-step fix guide. The next assessment confirms the fix.

14 days of daily monitoring and alerts, every finding with its fix guide, and reports on up to 3 tenants, from your first connected tenant. No card. Then choose the plan that fits.Where this check fits: Microsoft 365 security assessment for MSPs