Exchange ServerHow-to

Antivirus on Exchange Server: the exclusions Microsoft documents and how to test them

The folders, processes and file extensions Microsoft says to exclude from antivirus on Exchange Server SE and 2019, how AMSI differs, and how to prove the exclusions work with Test-ExchAVExclusions.

Antivirus and Exchange can run on the same server, but only with the exclusions Microsoft documents. Without them, a scanner can lock or quarantine a database or log file that Exchange has open, and Microsoft warns this can cause severe problems, including data loss. Here's what to exclude on Exchange Server SE and 2019, how AMSI fits in, and how to test the exclusions instead of trusting a policy screenshot.

Errors this guide fixes

  • -1032 JET_errFileAccessDeniedApplication log (ESE)
How this guide is organised: How it works → What Microsoft says to exclude → Step-by-step → Verify → Tips & gotchasFlow diagram of the article's sections in reading order: 1. How it works. 2. What Microsoft says to exclude. 3. Step-by-step (4 steps: Generate the list for each server; Put them in the managing policy; Test them with Test-ExchAVExclusions.ps1; Fix and test again). 4. Verify. 5. Tips & gotchas. Toolbox: Test-AMSI.ps1, Microsoft.Exchange.Store.Service.exe, Microsoft.Exchange.Store.Worker.exe, %ExchangeInstallPath%, %ExchangeInstallPath%Mailbox.1How it works2What Microsoftsays to exclude3Step-by-step4Verify5Tips & gotchas1Generate the list for eachserver2Put them in the managingpolicy3Test them withTest-ExchAVExclusions.…4Fix and test againTOOLBOXTest-AMSI.ps1Microsoft.Exchange.Store.Service.…Microsoft.Exchange.Store.Worker.e…%ExchangeInstallPath%%ExchangeInstallPath%MailboxHow this guide is organised: How it works → What Microsoft says to exclude → Step-by-step → Verify → Tips & gotchasFlow diagram of the article's sections in reading order: 1. How it works. 2. What Microsoft says to exclude. 3. Step-by-step (4 steps: Generate the list for each server; Put them in the managing policy; Test them with Test-ExchAVExclusions.ps1; Fix and test again). 4. Verify. 5. Tips & gotchas. Toolbox: Test-AMSI.ps1, Microsoft.Exchange.Store.Service.exe, Microsoft.Exchange.Store.Worker.exe, %ExchangeInstallPath%, %ExchangeInstallPath%Mailbox.1How it works2What Microsoft says to exclude3Step-by-step1Generate the list for each server2Put them in the managing policy3Test them with Test-ExchAVExclusions.ps14Fix and test again4Verify5Tips & gotchasTOOLBOXTest-AMSI.ps1Microsoft.Exchange.Store.Service.exeMicrosoft.Exchange.Store.Worker.exe%ExchangeInstallPath%%ExchangeInstallPath%Mailbox
At a glance: how this guide is organised · 4 steps · 5 key settings and tools

How it works#

  • Windows antivirus scans in two ways: real-time (memory-resident) protection of files and processes as they're used, and file-level scans of the disk on demand or on a schedule. Microsoft's folder exclusions apply to both.
  • Microsoft says its Exchange exclusion guidance takes precedence over vendor guidance, because of the way Exchange uses its files.
  • Windows antivirus doesn't replace mail hygiene: it can't detect threats that exist only inside email. That's the job of the Exchange Malware agent, Exchange Online Protection or your mail filter.
  • AMSI is a separate layer. Exchange's Antimalware Scan Interface integration hands the content of incoming HTTP requests to your AMSI-capable antivirus before Exchange processes them. File and process exclusions don't switch that off, and you should keep it on; see Exchange Emergency Mitigation service and AMSI. CSS-Exchange has a separate Test-AMSI.ps1 script for that side.

What Microsoft says to exclude#

Paths use %ExchangeInstallPath% (default C:\Program Files\Microsoft\Exchange Server\V15\). If you moved databases, logs or transport folders, exclude their real locations; Get-MailboxDatabase -Server EX01 | Format-List EdbFilePath, LogFolderPath shows the database paths.

Folders (Mailbox servers)#

FolderContents
%ExchangeInstallPath%MailboxDatabases, checkpoint and log files, content index (default location)
%ExchangeInstallPath%TransportRoles\Data\Queue, \SenderReputation, \TempQueue database, sender reputation, content conversion
%ExchangeInstallPath%TransportRoles\Logs, \Pickup, \ReplayTransport logs, Pickup and Replay directories
%ExchangeInstallPath%LoggingExchange process logs
%ExchangeInstallPath%ClientAccess\OAB, FIP-FS, GroupMetrics, Working\OleConverterOffline address book, malware/DLP scanning engine, MailTips group metrics, RTF/TNEF conversion
%SystemDrive%\inetpub\temp\IIS Temporary Compressed FilesIIS compression for Outlook on the web
%SystemRoot%\Temp\OICE_<GUID>Exchange Search file conversion
%SystemRoot%\ClusterDAG members: cluster quorum database
%SystemDrive%\DAGFileShareWitnesses\<DAG FQDN>On the witness server; confirm with Get-DatabaseAvailabilityGroup DAG1 | Format-List *Witness*

Edge Transport servers add TransportRoles\Data\Adam and TransportRoles\Data\IpFilter. Exchange 2016 also has four UnifiedMessaging folders; Unified Messaging isn't available in Exchange 2019 or SE.

Processes#

Microsoft lists more than 40 processes. The critical ones are the Information Store (Microsoft.Exchange.Store.Service.exe, Microsoft.Exchange.Store.Worker.exe), transport (EdgeTransport.exe, MSExchangeTransport.exe, MSExchangeFrontendTransport.exe, MSExchangeDelivery.exe, MSExchangeSubmission.exe), replication (MSExchangeRepl.exe, MSExchangeDagMgmt.exe), search (Microsoft.Exchange.Search.Service.exe, noderunner.exe, ParserServer.exe, hostcontrollerservice.exe), the FIP-FS scanning components (fms.exe, ScanningProcess.exe, UpdateService.exe), Managed Availability (MSExchangeHMHost.exe, MSExchangeHMWorker.exe), plus inetinfo.exe and OleConverter.exe. Take the full list from Microsoft's page or the script below rather than typing it by hand.

File name extensions#

A safety net in case folder exclusions fail or files move: .config; .chk, .edb, .jfm, .jrs, .jsl, .log, .que (databases); .dsc and .txt (Group Metrics); .lzx (offline address book); and on Exchange 2016, .cfg and .grxml (Unified Messaging).

Step-by-step#

1. Generate the list for each server#

CSS-Exchange's Set-ExchAVExclusions.ps1 works out the expected exclusions for the local server. Run it from an elevated Exchange Management Shell on each Exchange server:

PowerShell
.\Set-ExchAVExclusions.ps1 -ListRecommendedExclusions -FileName .\Exclusions-EX01.txt

On servers protected by Microsoft Defender Antivirus, running the script without parameters adds the exclusions to Defender. For a third-party product, give the file to whoever manages it.

2. Put them in the managing policy#

If Defender is managed centrally (Intune, Configuration Manager or Group Policy), add the exclusions to that policy too, so the security team sees them and they still apply if local exclusions stop being merged. Check what Defender is really using:

PowerShell
$mp = Get-MpPreference
$mp.ExclusionPath; $mp.ExclusionProcess; $mp.ExclusionExtension

3. Test them with Test-ExchAVExclusions.ps1#

Warn your security team first. The script writes the harmless EICAR test file into every folder on Microsoft's list and tests each documented extension in a temporary folder, so alerts are expected.

PowerShell
.\Test-ExchAVExclusions.ps1
.\Test-ExchAVExclusions.ps1 -Recurse -WaitingTimeForAVAnalysisInMinutes 10

By default it waits five minutes for the antivirus to react. A test file that disappears means that path or extension is being scanned. Next, it lists the modules loaded into Exchange processes and reports the non-default ones; a module from an antivirus or security vendor is a strong sign the process exclusions aren't working. -Recurse also drops the file into every subfolder. Results land next to the script: a results log, a debug log and BadExclusions-<Server>-<DateTime>.txt listing the folders, extensions and processes to fix.

4. Fix and test again#

Work through the bad-exclusions file with the vendor, then repeat the test until it comes back clean. Run it again after antivirus agent upgrades, policy changes and Exchange cumulative updates, because exclusions are easy to lose.

Verify#

  • EICAR files survive in every tested folder, and the extension test files survive too.
  • No antivirus or security vendor modules are reported inside Exchange processes.
  • Databases stay mounted and copies healthy: Get-MailboxDatabaseCopyStatus -Server EX01 | Format-Table Name, Status, ContentIndexState shows Mounted or Healthy with a Healthy content index.

Tips & gotchas#

  • Signs of missing exclusions follow from the locking problem Microsoft describes: databases that dismount or won't mount, ESE error -1032 (JET_errFileAccessDenied, a file locked or in use), transaction logs quarantined, a failed content index, slow or stuck transport queues, high CPU from scanning, and updates that fail on locked files. Test the exclusions before you chase anything else.
  • Remote scans count. Microsoft notes that scanning Exchange folders from another machine can cause the same file locks.
  • Third-party security agents can still cause unexpected behaviour with correct exclusions; when troubleshooting, Microsoft may ask you to disable or uninstall them temporarily to establish a baseline.
  • Exclusions don't blind you everywhere. The web-facing folders where Microsoft has found web shells aren't on the list, so a full scan still covers them; see Is my Exchange server compromised?
  • Updates. If an update fails on a locked file, see Installing Exchange Server security updates.

References#

Written and checked against current Microsoft Learn documentation. Test changes with a pilot group before rolling them out to everyone, and if an admin center path has moved since, search for the setting name instead.

Spotted a mistake, or did this fix work differently for you? Email me or message me on LinkedIn — corrections are credited in the article.

Written by

Omer Eltayeb

Intune Subject Matter Expert in Cairo, Egypt, former Microsoft Cloud Solutions Architect, Microsoft Certified Trainer and Microsoft Innovative Educator Expert (2024–26) and Microsoft Elevate Educator Expert (2026–27). I share practical, step-by-step guides, study plans, scripts and toolkits for Microsoft Intune, Configuration Manager, Microsoft Entra ID, Microsoft Defender, Exchange and Microsoft 365 with the community.

Microsoft Certified Trainer (MCT) 2026Microsoft Innovative Educator Expert 2025–2026Microsoft Elevate Educator Expert 2026–2027ISC2 Certified Information Systems Security Professional (CISSP)Microsoft 365 Certified: Enterprise Administrator Expert (MS-102)