11/18/2026
Add-MpPreference 0x800106ba: Defender Is Not Running
Short answer: Add-MpPreference failing with 0x800106ba points to the Microsoft Defender Antivirus service not running. When I hit it, another antivirus was the active one, and on Windows 10 and 11 that switches Defender off automatically. Run Get-MpComputerStatus and read AMRunningMode: anything other than Normal means Defender is not your primary scanner. Add your folder exclusions in the antivirus that is active, not in Defender.
The error, and the setting that hides the cause
The exclusion command most guides give looks like this, run in an elevated PowerShell window:
Add-MpPreference -ExclusionPath 'D:\src\myapp\node_modules'
When Defender is not the active scanner, it fails with:
Add-MpPreference : Operation failed with the following error: 0x800106ba.
That exact line came back on 10/14/2026, on my own Windows 10 machine, while chasing a slow test suite. A coding agent had reported that Defender's real-time protection was on and handed over an exclusion command for the projects' venv and node_modules folders. It was wrong: another antivirus was active, and Defender was not running at all. The agent corrected itself on the record within a minute of the paste, and the lesson is the useful part of this post.
Why "real-time protection is on" can be false
The agent had read a preference, not the service. On the same machine, on 10/26/2026, Get-MpPreference still reports the default:
DisableRealtimeMonitoring : False
False there means "nobody configured Defender to stop scanning". It says nothing about whether Defender is scanning. Microsoft's Get-MpPreference reference returns stored preferences; whether the engine is running is a separate question with a separate cmdlet. The Add-MpPreference reference does not list 0x800106ba at all, which is why searching the code mostly turns up forum threads.
Check which antivirus is active
Three read-only checks, each answering a slightly different question:
| Check | What it tells you |
|---|---|
Get-MpComputerStatus |
Whether Defender itself is running, and in which mode |
Get-CimInstance -Namespace root/SecurityCenter2 -ClassName AntivirusProduct |
Which antivirus products are registered with Windows Security Center |
| Windows Security app, Virus & threat protection > Manage providers | Which product Windows reports as protecting the device |
Both commands below ran in an ordinary, non-elevated PowerShell window.
Defender's own status
Microsoft's compatibility page for Defender names the field to read: AMRunningMode should be Normal, Passive or EDR Block Mode if antivirus protection is enabled. On the machine that threw the error, checked on 10/26/2026:
Get-MpComputerStatus | Select-Object AMRunningMode, AMServiceEnabled, AntivirusEnabled, RealTimeProtectionEnabled
AMRunningMode : Not running
AMServiceEnabled : False
AntivirusEnabled : False
RealTimeProtectionEnabled : False
The Get-MpComputerStatus reference shows what a healthy machine returns: AMRunningMode : Normal and True down the column. Get-Service WinDefend agreed here: Stopped. There was no MsMpEng.exe in the process list either, which is Microsoft's other suggested check.
Which products Windows knows about
Get-CimInstance -Namespace root/SecurityCenter2 -ClassName AntivirusProduct |
Select-Object displayName, productState
displayName : Windows Defender
productState : 393472
displayName : Avast Antivirus
productState : 270336
Both products are listed, so this is a list of registered products, not a verdict on which one is scanning. Read the names here and take the verdict from AMRunningMode. productState is a packed number; you do not need to decode it to answer this question.
Why Defender is off, and why not to force it back on
Microsoft's compatibility table is plain about the mechanism: on Windows 10 and 11, when a non-Microsoft antivirus is the primary solution and the device is not onboarded to Microsoft Defender for Endpoint, Defender goes into disabled mode, automatically. On Windows 11 with Smart App Control on, it may show passive mode instead. Neither state means Defender is the scanner touching your build's files.
AMRunningMode |
What it means | Where exclusions go |
|---|---|---|
Normal |
Defender is the primary antivirus | Add-MpPreference, elevated |
Passive or EDR Block Mode |
Another product is primary; Defender plays a supporting role | The primary product |
Not running |
Defender is disabled; another product is primary | The other product only |
Starting the WinDefend service by hand is not the fix. The same page describes two products both attempting active protection as a conflict that "will impact performance and is not supported". Defender also comes back on its own: Microsoft says it can be re-enabled automatically if the other product expires, is uninstalled or stops providing real-time protection. That is the moment a Defender exclusion becomes worth adding: exclusions set in the other product do nothing for Defender, so the slow build can return after an antivirus subscription lapses.
Excluding folders in the scanner that is active
When the other product is active
On the machine where this came up, that product was Avast Antivirus, the free edition, and its exclusions live in its own settings, documented on Avast's scan exclusions page. Menus differ between products, versions and editions, so follow your vendor's own page rather than a screenshot from someone else's. The agent that wrote me a step for an "HTTPS scanning" switch found out the hard way: the free edition has no Web Shield, so the setting did not exist.
When Defender is active
Use an elevated PowerShell window, per Microsoft's guide to configuring Defender exclusions. Add-MpPreference adds to the list; Set-MpPreference replaces every existing exclusion of that type, so reach for Add unless replacing is what you mean.
Two rules from Microsoft's exclusions overview catch developers out:
\*\matches exactly one folder.D:\src\*\node_modulescoversD:\src\app\node_modules, notD:\src\client\app\node_modules. Add another\*\per level, up to six wildcards per entry.- Environment variables resolve as the system account. Defender runs as LocalSystem, so
%LOCALAPPDATA%in an exclusion points atC:\Windows\System32\config\systemprofile\AppData\Local, not your profile. An exclusion for%LOCALAPPDATA%\npm-cachesilently misses your npm cache. Write the full path.
Microsoft also says every exclusion "is a protection gap", so exclude build output and package folders, not your whole drive.
Dev Drive, and why it does not help here
Dev Drive is Windows 11's ReFS volume for repositories and caches, where Defender scans in performance mode instead of being switched off for a folder. Our Dev Drive setup guide covers creating one and moving npm and pip caches onto it.
It depends on the same thing this error is about. Microsoft's performance mode page requires Defender to be the primary antivirus with real-time protection on. If AMRunningMode says Not running, a Dev Drive gives you no performance mode. Microsoft's Dev Drive FAQ says other antivirus products do not get performance mode, though you can adjust which filters attach to the drive. Two more limits: Dev Drive needs Windows 11, and the machine in this post runs Windows 10 22H2.
Verify the exclusion took effect
For Defender, Microsoft documents MpCmdRun.exe -CheckExclusion (platform 4.18.2111 or later) in an elevated Command Prompt. Their command to reach the platform folder starts with cd /d, because the folder can be on a different drive from where you are; cd /d in cmd explains why plain cd would leave you behind. Then:
MpCmdRun.exe -CheckExclusion -Path D:\src\myapp\node_modules
It prints is excluded with exit code 0, or is not excluded with exit code 1. A parent folder's exclusion also counts, and the output does not say which entry matched. Microsoft's same page describes testing with the harmless EICAR test file: create it inside the excluded folder, and if Defender does not flag it, the exclusion works. For another product, use its own checks.
One more trap when checking by reading the list instead: in a non-elevated window, Get-MpPreference shows ExclusionPath as N/A: Must be an administrator to view exclusions, which is easy to misread as "no exclusions".
Measure before and after
An exclusion is a guess about where the time goes. In the case behind this post, the scanner turned out not to be the bottleneck: the disk was. The numbers the agent measured on 10/14/2026, in CS Powerhouse issue 189, against what I see now:
| Measure | On E:, a spinning 2 TB laptop drive | After the move to the D: SSD |
|---|---|---|
| One test file, collection only | 239 seconds, 204 of them importing the shared test setup | About 9 seconds on 10/26/2026 (a different file, so approximate) |
| One read of a project file | 48 to 133 ms, with 28 requests queued | About 2 ms on the SSD |
| Starting pytest with a warm cache | 1 second | Not re-measured |
| The quick test tier | Minutes | About 22 seconds (the agent's report, 10/15/2026) |
The clue that pointed away from the scanner came from a different session the same afternoon. A script hung, the agent guessed the virus scanner, and I told it the folder was already in Avast's exclusion list and had been for a while. It still crawled. The agent timed the disk, wrote "I was wrong about Avast," and the move to the SSD followed. Every project was running from the new drive by 10/21/2026.
That does not clear Avast everywhere. On 09/24/2026 a bare PHP server answering a one-line script stalled on 28 of 1,200 requests with Avast running and on none with it stopped. Avast's behavior monitoring was holding connections open after PHP had answered. A scanner can cost you time without being the reason your build is slow, which is the argument for timing the slow command once before an exclusion and once after. If the number does not move, remove the exclusion, because a protection gap that buys nothing is all cost.

Let my Claude help your Claude
If you want a second pair of eyes on how your own setup uses AI-assisted development, that's what this is: me, personally, for AI specifically. Broader business growth and technology consulting is Brandager's own team.
Researched and drafted with AI, then reviewed and edited by the site's editors.