DefenderTroubleshooting

Defender Antivirus high CPU (MsMpEng.exe): find the cause with the performance analyzer

Antimalware Service Executable eating CPU? Tell scans from real-time scanning, record with the performance analyzer, then fix it with the narrowest exclusion or a scan-setting change.

When Antimalware Service Executable (MsMpEng.exe) sits near the top of Task Manager, the quick fix people reach for is a broad exclusion, which removes protection and often misses the real cause. In this post I'll show how to tell scheduled scans from real-time scanning, record what Defender is actually scanning with the performance analyzer, and fix it with the narrowest change that works.

Errors this guide fixes

  • Antimalware Service ExecutableTask Manager (high CPU)
  • Cannot start performance recording because Windows Performance Recorder is already recordingPowerShell (New-MpPerformanceRecording)
  • Event ID 1000 (Windows Defender): An antimalware scan started.Event Viewer (Windows Defender/Operational)
  • Event ID 1001 (Windows Defender): An antimalware scan finished.Event Viewer (Windows Defender/Operational)
How this guide is organized: Symptoms → Why it happens → How to fix it → Verify the fix → Prevent it next timeFlow diagram of the article's sections in reading order: 1. Symptoms. 2. Why it happens. 3. How to fix it (6 steps: Find out when the CPU goes up; Record with the performance analyzer; Read the report; Fix scan-driven CPU; Fix real-time CPU with the narrowest exclusion; Developers on Windows 11: use Dev Drive). 4. Verify the fix. 5. Prevent it next time. Toolbox: *.log, MsMpEng.exe, builder.exe, Set-MpPreference, SkipReason.1Symptoms2Why it happens3How to fix it4Verify the fix5Prevent it nexttime1Find out whenthe CPU goes…2Record withthe performa…3Read thereport4Fixscan-driven C…5Fix real-timeCPU with the…6Developers onWindows 11: u…TOOLBOX*.logMsMpEng.exebuilder.exeSet-MpPreferenceSkipReasonHow this guide is organized: Symptoms → Why it happens → How to fix it → Verify the fix → Prevent it next timeFlow diagram of the article's sections in reading order: 1. Symptoms. 2. Why it happens. 3. How to fix it (6 steps: Find out when the CPU goes up; Record with the performance analyzer; Read the report; Fix scan-driven CPU; Fix real-time CPU with the narrowest exclusion; Developers on Windows 11: use Dev Drive). 4. Verify the fix. 5. Prevent it next time. Toolbox: *.log, MsMpEng.exe, builder.exe, Set-MpPreference, SkipReason.1Symptoms2Why it happens3How to fix it1Find out when the CPU goes up2Record with the performance analyzer3Read the report4Fix scan-driven CPU5Fix real-time CPU with the narrowest exclusion6Developers on Windows 11: use Dev Drive4Verify the fix5Prevent it next timeTOOLBOX*.logMsMpEng.exebuilder.exeSet-MpPreferenceSkipReason
At a glance: how this guide is organized · 6 fix steps · 5 key tools

Symptoms#

  • Task Manager shows Antimalware Service Executable using a lot of CPU during builds, installs, sign-in or at the same time every day.
  • Specific applications such as compilers, package managers, database or log writers and backup agents slow down while Defender works.
  • The busy periods line up with these events in the Windows Defender Operational log:
Text
Event ID 1000 (Windows Defender): An antimalware scan started.
Event ID 1001 (Windows Defender): An antimalware scan finished.
  • Starting a recording fails with Cannot start performance recording because Windows Performance Recorder is already recording.

Why it happens#

Which Defender workload drives the CPU, and the narrowest fixDo the spikes sit between event 1000 and 1001 (or 1002)? if Yes, a scan: Move and throttle scheduled scans (Out of working hours, quick scans, ScanAvgCPULoadFactor, low priority.); if No scan running: Which hot spot does the performance analyzer report show? if One process: Scope a contextual exclusion to it (Or exclude it by full path, never by image name alone.); if One folder: Add a contextual folder exclusion (Only for on-access scans; needs Defender as the primary antivirus.); if One extension: Exclude a path with a wildcard (Such as C:\Data\*.log; an extension exclusion applies on every drive.)Do the spikes sit betweenevent 1000 and 1001 (or 1002)?FIXMove and throttlescheduled scansOut of working hours, quickscans,ScanAvgCPULoadFactor,low priority.Yes, a scanWhich hot spot does theperformance analyzer reportshow?FIXScope a contextualexclusion to itOr exclude it by full path,never by image name alone.One processFIXAdd a contextual folderexclusionOnly for on-access scans;needs Defender as theprimary antivirus.One folderFIXExclude a path with awildcardSuch as C:\Data\*.log; anextension exclusion applieson every drive.One extensionNo scan runningWhich Defender workload drives the CPU, and the narrowest fixDo the spikes sit between event 1000 and 1001 (or 1002)? if Yes, a scan: Move and throttle scheduled scans (Out of working hours, quick scans, ScanAvgCPULoadFactor, low priority.); if No scan running: Which hot spot does the performance analyzer report show? if One process: Scope a contextual exclusion to it (Or exclude it by full path, never by image name alone.); if One folder: Add a contextual folder exclusion (Only for on-access scans; needs Defender as the primary antivirus.); if One extension: Exclude a path with a wildcard (Such as C:\Data\*.log; an extension exclusion applies on every drive.)Do the spikes sit between event 1000 and 1001(or 1002)?Yes, a scanFIXMove and throttle scheduled scansOut of working hours, quick scans,ScanAvgCPULoadFactor, low priority.No scan runningWhich hot spot does the performanceanalyzer report show?One processFIXScope a contextual exclusion to itOr exclude it by full path, never by image namealone.One folderFIXAdd a contextual folder exclusionOnly for on-access scans; needs Defender as theprimary antivirus.One extensionFIXExclude a path with a wildcardSuch as C:\Data\*.log; an extension exclusionapplies on every drive.
Figure 1 · Decision tree Which Defender workload drives the CPU, and the narrowest fix. Use the scan events to separate scans from real-time scanning, then let the performance analyzer report point to the narrowest exclusion.

Defender's CPU comes from two different workloads, and they need different fixes:

  • Scans: scheduled quick or full scans, catch-up scans and on-demand scans. A full scan reads every file on the device.
  • Real-time (on-access) scanning: every file a process opens or writes is inspected. Workloads that touch thousands of files a minute, such as build output, package caches, log folders and VDI profiles, generate a steady stream of scans.

Two things make both worse: a second real-time antivirus running next to an active Defender (see active and passive mode), and exclusions that never match because they're written wrongly.

How to fix it#

1. Find out when the CPU goes up#

PowerShell
Get-WinEvent -FilterHashtable @{
    LogName = 'Microsoft-Windows-Windows Defender/Operational'; Id = 1000, 1001, 1002
} -MaxEvents 20 | Select-Object TimeCreated, Id, Message

Get-MpPreference | Select-Object ScanParameters, ScanScheduleDay, ScanAvgCPULoadFactor

If the spikes sit between a 1000 and a 1001 (or 1002, a scan stopped before it finished), it's a scan problem; go to step 4. If CPU is high with no scan running, it's real-time scanning, so record it.

2. Record with the performance analyzer#

The analyzer needs platform version 4.18.2108.7 or later and runs on Windows 10, Windows 11 and Windows Server 2016 or later (Windows Server 2012 R2 on the unified solution also needs the Windows Performance Toolkit from the Windows ADK). In an elevated PowerShell session, start a recording to a folder that exists, reproduce the slow task, then press Enter:

PowerShell
New-MpPerformanceRecording -RecordTo C:\Perf\defender-scans.etl

If you get the "already recording" error, cancel the stale trace and start again:

Command Prompt
wpr -cancel -instancename MSFT_MpPerformanceRecording

3. Read the report#

PowerShell
$etl = 'C:\Perf\defender-scans.etl'
Get-MpPerformanceReport -Path $etl -TopFiles 10 -TopExtensions 10 -TopProcesses 10 -TopScans 10
Get-MpPerformanceReport -Path $etl -TopFiles 3 -TopScansPerFile 10
(Get-MpPerformanceReport -Path $etl -TopScans 1000).TopScans |
    Export-Csv -Path C:\Perf\scans.csv -Encoding UTF8 -NoTypeInformation

Look for concentration: one process behind most scans, one folder that's rewritten constantly, or one extension with a high total duration. The report shows scan counts, durations, paths, processes and the reason for each scan, and the SkipReason column shows Not Skipped, Optimization (usually a performance optimization) or User skipped (usually an exclusion you set).

4. Fix scan-driven CPU#

  • Move scheduled scans out of working hours and prefer quick scans for the regular schedule.
  • ScanAvgCPULoadFactor limits the average CPU a scan should use (default 50 percent), and Set-MpPreference -EnableLowCpuPriority $true runs scheduled scans at low CPU priority.
  • Set these in your Intune or Group Policy antivirus policy rather than locally, so they don't drift or conflict.

5. Fix real-time CPU with the narrowest exclusion#

Every exclusion is a protection gap, so pick the smallest one that removes the hot spot:

  1. Contextual exclusion (best): exclude a folder only for on-access scans, or only when a named process opens it. It needs Defender as the primary antivirus, platform 4.18.2205.7 and engine 1.1.19300.2 or later, and can't be set in the Windows Security app. Keywords and values are case-sensitive, and a backslash must precede the colon.
PowerShell
Add-MpPreference -ExclusionPath 'C:\BuildOutput\: {PathType:folder,ScanTrigger:OnAccess,Process:"C:\Tools\builder.exe"}'
  1. Process exclusion by full path: skips files that process opens. An image name alone (builder.exe) matches that name anywhere, even on removable media, and process exclusions also stop network protection and ASR rules from inspecting the process.
  2. Folder exclusion: covers the folder and its subfolders, except reparse point subfolders.
  3. Extension exclusion (last resort): applies on every drive. Prefer a path with a wildcard, such as C:\Data\*.log.

Avoid mapped drive letters (use the real network path) and file names without a path. Environment variables resolve in the SYSTEM context, so %TEMP% means C:\Windows\TEMP. Excluded files can still raise EDR alerts and behavioral detections.

6. Developers on Windows 11: use Dev Drive#

On a trusted Dev Drive, performance mode scans files asynchronously ("open now, scan later"), which Microsoft says gives significantly better protection than folder exclusions. It's on by default for new Dev Drives and needs Defender as the primary antivirus with real-time protection on (platform 4.18.2303.8 and security intelligence 1.385.1455.0 or later). Turn it on with Set-MpPreference -PerformanceModeStatus Enabled, the Defender CSP setting ./Device/Vendor/MSFT/Defender/Configuration/PerformanceModeStatus (0 enables it) or the Group Policy setting Configure performance mode status. Microsoft is clear that performance mode isn't a fix for general MsMpEng.exe high CPU; use the analyzer for that.

Verify the fix#

  • Record the same workload again and compare total duration and top processes; your excluded paths should now show User skipped.
  • Watch Task Manager during the workload: CPU should drop back after short bursts.
  • Confirm the exclusion with Get-MpPreference | Select-Object -ExpandProperty ExclusionPath (unless exclusions are hidden from local admins).

Prevent it next time#

  • Measure before you exclude, and record why each exclusion exists. Review the list regularly.
  • Keep the Defender platform and engine current; see platform and engine updates.
  • Manage exclusions in one policy; local and policy lists merge by default, which hides forgotten entries (Defender settings not applying).

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)