How to disable Windows Defender temporarily (and get it back on)
The real-time protection switch for one PC and the fixes when it won't move, the PowerShell, Group Policy and Intune settings, troubleshooting mode for managed fleets, passive mode, the Defender service and Malwarebytes.
Updated: November 2026
An installer gets quarantined halfway through, or a test tool trips a detection, and the ticket says "just turn Defender off." Turning it off takes four clicks. Here's how to disable Windows Defender temporarily on one PC, why tamper protection quietly ignores the shortcuts, and what to use instead on managed devices so protection comes back on.
TL;DR
- One PC: Windows Security > Virus & threat protection > Manage settings, Real-time protection off, then on again. Windows restores it after a short while anyway.
- Scripts: registry, Group Policy and Set-MpPreference changes fail silently while tamper protection is on.
- Managed fleets: Defender for Endpoint troubleshooting mode gives four unlocked hours, then reverts by itself.
- For good: install another antivirus and leave the WinDefend service running.
Check what Defender blocked first
Open Windows Security, go to Virus & threat protection and select Protection history. Every block and quarantine is listed there with the file path and the detection name. Often, the fix is sitting on that screen.
If the detection is a false positive on a file you trust, restore that one item and allow it. If a line-of-business app keeps tripping the same rule, a narrow exclusion for its exact path beats switching protection off for the whole machine. And if the detection name looks like a real threat, stop. Fake installers are how a trojan virus usually gets in, and that one isn't going on the PC.
Server teams see the same pattern at scale. A database group blames Defender for slow queries, asks for it off, and the real cause turns out to be an exclusion written with the wrong syntax.
How to disable Windows Defender temporarily on one PC
On a personal or unmanaged Windows 10 or 11 PC, the supported switch lives in the Windows Security app:
- Open Windows Security and select Virus & threat protection.
- Under Virus & threat protection settings, select Manage settings.
- Switch Real-time protection to Off and accept the UAC prompt.
- Run the install or test.
- Switch Real-time protection back to On.
On Windows 11 the same switch is also under Settings > Privacy & security > Windows Security > Virus & threat protection. On Windows 10 the path starts at Settings > Update & Security > Windows Security. Windows has no separate Pause button for Defender, so this toggle is the pause.
Step 5 matters even though Windows has a safety net. Microsoft's support page says real-time protection "will turn back on automatically after a short while." It doesn't say how long. Scheduled scans keep running in the gap, but files downloaded or installed while it's off aren't scanned until the next scheduled scan.
So the gap is the risk. Anything that lands on the disk in that window gets a free pass until the next scan runs. Keep the window short, download the installer before you switch protection off, and don't browse while you wait.
If the toggle is greyed out with a "managed by your administrator" note, the PC is under policy. The Windows Security app won't override that, and neither should you. Skip to troubleshooting mode below.
When the switch won't turn off
Three things stop the toggle, and each one has its own fix:
- It won't switch off. Microsoft's support page says tamper protection has to be off before real-time protection can be switched off. Tamper protection sits further down the same Manage settings page. Switch both back on together when you're done.
- It's greyed out, or Windows Security says your IT administrator has limited access. Intune, Group Policy or Defender for Endpoint owns the setting, so ask whoever manages the device. Our guide to Virus & threat protection explains the greyed-out page.
- There's no switch at all. Another antivirus is registered as the primary, so Defender has already handed over. Pause that product from its own console.
Why tamper protection ignores your script
Search for this topic and you'll find the same three shortcuts: a registry value, a Group Policy setting and Set-MpPreference -DisableRealtimeMonitoring $true. On a current Windows build, all three tend to do nothing.
That's tamper protection. With it on, real-time protection, behavior monitoring and cloud protection stay on, exclusions can't be added, and registry changes to Defender settings are blocked. Microsoft's tamper protection overview warns that changes made through a management tool, Group Policy included, "might appear to succeed" while tamper protection blocks them. The command returns without an error. Protection stays on.
It works this way because switching off the antivirus is the first thing an attacker's script tries. An exploit that lands with admin rights gets the same PowerShell you do, so the lock can't depend on who's typing. Microsoft turns tamper protection on by default for new Defender for Endpoint deployments.
Matt Soseman walks through what tamper protection locks and why he doesn't recommend switching it off.
The PowerShell, Group Policy and Intune Settings
Where tamper protection is off, or while troubleshooting mode is on, the documented switches do work. Run them from an elevated PowerShell window and undo them in the same session:
powershellSet-MpPreference -DisableRealtimeMonitoring $true # run the install or test Set-MpPreference -DisableRealtimeMonitoring $false
In Group Policy, the setting is Computer Configuration > Administrative Templates > Windows Components > Microsoft Defender Antivirus > Real-time Protection > Turn off real-time protection. Our Group Policy Editor guide covers gpedit and gpupdate /force.
In Intune, it's Allow Real-Time Monitoring in an Endpoint security antivirus policy, and tamper protection lives in the Windows Security Experience profile. Microsoft's CSP reference notes that changes to real-time monitoring aren't applied while tamper protection is on.
Older guides still quote the Turn off Microsoft Defender Antivirus policy (DisableAntiSpyware). Microsoft ignores it on devices onboarded to Defender for Endpoint from platform version 4.18.2108.4, and tamper protection guards it on Windows 10 version 1903 and later. For a PC that needs Defender off for good, the supported route is another antivirus: install it and Windows switches Defender off on its own.
On managed devices, use troubleshooting mode
For devices onboarded to Microsoft Defender for Endpoint, Microsoft built a sanctioned way to open the lock. A Security Administrator opens the device page in the Defender portal, selects More options, then Turn on troubleshooting mode. Activation can take up to 15 minutes.
While it's active, a local admin can change settings that policy usually locks, including tamper protection itself with Set-MpPreference -DisableTamperProtection $true. They still can't turn off or uninstall Microsoft Defender Antivirus. The troubleshooting mode docs (updated September 2026) set the limits: it switches off after four hours, a device gets eight hours per 24, and policy-managed settings revert to their previous values when it ends.
That revert is the feature. Nobody has to remember to switch tamper protection back on, and the user gets notified when the window opens, is about to close and closes. The session also shows up in the device timeline, so the change is on the record.
Migrations are where this earns its keep. One admin moving servers off McAfee used it to test a backout plan into passive mode:
Better than off: narrow exclusions and passive mode
Often the ask behind "turn it off" is narrower: stop scanning this one thing. Here's what fits each case:
| Situation | Use | Protection left on |
|---|---|---|
| One installer on an unmanaged PC | Real-time protection toggle, back on after | Scheduled scans |
| A trusted app keeps getting blocked | Exclusion for its exact file or folder path | Everything else |
| Managed device, locked settings | Troubleshooting mode | Defender Antivirus stays installed |
| Another antivirus is the primary | Passive mode or automatic disable | The other product |
For an exclusion, use a full path: Add-MpPreference -ExclusionPath "C:\Program Files\Contoso\app.exe". Remove it with Remove-MpPreference once the vendor fixes the detection. Microsoft's list of exclusions to avoid rules out C:\Temp, user profile folders, extensions like .exe and .ps1, and processes like powershell.exe. It also flags a trap: Defender reads %TEMP% as the system account, so it points at C:\Windows\Temp, not the user's temp folder.
If a different antivirus is the real primary, Windows 10 and 11 already handle it. Install a compatible third-party product and Defender switches itself off. Remove that product or let its license lapse and Defender turns back on. On devices onboarded to Defender for Endpoint, it drops into passive mode instead. Windows Server doesn't switch on its own, and Microsoft says not to stop the WinDefend or MsMpEng services by hand.
What Microsoft Defender passive mode means
Passive mode applies to devices onboarded to Defender for Endpoint where another antivirus is the primary. Defender keeps scanning files, reporting detections and taking security intelligence updates, but it doesn't block files in real time or remediate threats. Microsoft's compatibility guide lists what each mode keeps:
| Mode | When you see it | What Defender still does |
|---|---|---|
| Active (Normal) | Defender is the primary antivirus | Real-time blocking, cloud protection and remediation |
| Passive | Another antivirus is primary on a device onboarded to Defender for Endpoint | Scans and reports detections; EDR in block mode can still remediate |
| Disabled | Another antivirus is primary on a Windows 10 or 11 PC that isn't onboarded | Turns back on if the other product is removed, expires or stops protecting |
On Windows 11 with Smart App Control on, Defender can show passive mode without Defender for Endpoint, and Microsoft says that isn't the same passive mode. On Windows Server, set ForceDefenderPassiveMode (DWORD 1 under HKLM\SOFTWARE\Policies\Microsoft\Windows Advanced Threat Protection) before onboarding. Once Defender runs in active mode, tamper protection won't let it drop back to passive.
Can you stop the Microsoft Defender Antivirus service?
Not on a supported setup. The service is WinDefend and its process is MsMpEng.exe. Windows protects both, so the Services console and sc stop WinDefend refuse to stop it, usually with Access is denied. Microsoft's guidance is not to disable, stop or modify WinDefend, MsMpEng, wscsvc, SecurityHealthService or the Sense service, because it can destabilize the device.
The supported routes depend on why you want it stopped:
- Another antivirus is taking over on Windows 10 or 11. Install it, and Defender switches to disabled, or to passive on onboarded devices, by itself.
- Another antivirus is the primary on Windows Server 2019 or later. Remove Defender with
Uninstall-WindowsFeature Windows-Defender. - MsMpEng.exe is eating CPU. Cap the scan instead of stopping the engine; our guide to lowering CPU usage covers ScanAvgCPULoadFactor.
Windows Defender vs Malwarebytes
Both can sit on the same PC, and the Malwarebytes edition decides which one is in charge. Microsoft Defender Antivirus comes with Windows, runs real-time protection by default and is managed through Intune, Group Policy or Defender for Endpoint.
The paid Malwarebytes app adds its own real-time protection and registers with Windows Security Center unless you turn that off, and Windows then switches Defender off. The Windows Security Center switch is in its General settings; turn it off if you want both running. Malwarebytes Free scans on demand, without real-time protection, so it works as a second-opinion scanner next to Defender.
For business fleets, Malwarebytes sells its endpoint products under the ThreatDown name, and MSPs manage them through OneView. Our ThreatDown review covers the bundles and pricing.
Confirm Defender is back on
Don't trust the toggle. Ask Defender directly in an elevated PowerShell window:
powershellGet-MpComputerStatus | Select-Object IsTamperProtected, RealTimeProtectionEnabled, AntivirusEnabled, AMRunningMode Get-MpPreference | Select-Object ExclusionPath, ExclusionProcess
A healthy result reads True, True, True and Normal. Passive or EDR Block Mode is fine when another antivirus is the primary on purpose. Any False, or an exclusion nobody can explain, means the job isn't finished. Our PowerShell commands guide covers running checks like this against a remote machine.
OpenFrame, our platform, can run the same two lines as a script across a client's devices or your own fleet and collect the output, so one forgotten toggle shows up as a single row before it turns into next month's incident. It's open, AI-native infrastructure for IT and security at $1 per device a month with 10M AI tokens included, and the 14-day free trial covers a check like this.
The short version
To disable Windows Defender temporarily on an unmanaged PC, switch off real-time protection in Windows Security, do the install, then switch it back on. Windows turns it back on after a short while anyway. On managed devices, tamper protection blocks registry, Group Policy and PowerShell shortcuts, so use Defender for Endpoint troubleshooting mode, which reverts on its own after four hours. Before any of that, check Protection history: a restored false positive or a narrow exclusion often does the job without switching anything off. If another antivirus is taking over, install it and let Windows switch Defender off; leave the Defender service itself running.
If you're weighing Defender's paid tiers for a client fleet, our Microsoft Defender XDR review is the next read.

Aliaska Varieva
VP of Engineering
Hi! I’m Aliaska, and I’ve been working as a software engineer (mostly Java + a bit Kotlin) for over 8 years now. I mostly spend my time building backend services, integrating systems, fixing bugs (the fun part 🙃), and making sure things don’t fall apart behind the scenes.
Related Content
Frequently Asked Questions
/blog/how-to-disable-windows-defender-temporarily
Still deciding?
Ask Mingo answers from our docs and customer stories.