How to permanently disable Microsoft Defender Antivirus on Windows 10

soji256
4 min readFeb 14, 2021

Windows 10 is equipped with a mechanism to automatically enable Microsoft Defender Antivirus after rebooting, even if it is set to be disabled.

This mechanism generally helps to protect the device, but for security researchers, there are times when they want to disable it, such as when analyzing malware, verifying vulnerabilities, or playing CTF.

In this article, I will show you how to keep Microsoft Defender Antivirus disabled in Windows 10 even after a reboot.

Unwavering determination to disable Microsoft Defender Antivirus

Summary of Method

I was able to disable Microsoft Defender Antivirus by using Autoruns to stop all startups related to it.

For this operation, it was necessary to manually disable the Real-time protection beforehand.

I tried to find a way to disable it with a command, but Microsoft Defender Antivirus is more difficult to disable than I thought, and I couldn’t find a way to do it on Windows 10, which is close to the latest version.

Environment

  • Microsoft Windows 10 Pro 1909 [Version 10.0.18363.1316]

Get Autoruns

Autoruns

Turn off the Real-time protection.

Enter Tamper Protection in Start and turn off the Real-time protection setting.

Turn off the Real-time protection.

Stop Microsoft Defender Antivirus related startups

Run Autoruns (Autoruns64.exe) with administrative privileges.

Open the options and uncheck all items except Hide Empty Locations.

Check only the Hide Empty Locations.

Next, enter Windows Defender in the filter field.

Type Windows Defender in the filter field.

Uncheck all items except PolicyAgent in the following two categories. Please note that the displayed contents may differ slightly depending on your environment.

  • Task Scheduler
  • HKLM\System\CurrentControlSet\Services
Uncheck all items except PolicyAgent.

Then reboot, and Microsoft Defender Antivirus will be permanently disabled.

Checking the status

  • Get-Service WinDefend
PS C:\> Get-Service WinDefend

Status Name DisplayName
------ ---- -----------
Stopped WinDefend Microsoft Defender Antivirus Service
Microsoft Defender Antivirus is disabled. (1/2)
  • Get-MpPreference
PS C:\> Get-MpPreference
(snip)
DisableRealtimeMonitoring : True
Microsoft Defender Antivirus is disabled. (2/2)

Note

Some articles say that it can be disabled by installing third-party anti-virus software, but I haven’t tried it because it didn’t suit my purpose this time.

References

Successful Methods

Other methods

About Microsoft Defender Antivirus

Appendix: A collection of methods that did not work on Windows 10 1909

Set-MpPreference -DisableAutoExclusions $true

If you search for Windows Defender Disable in Windows 10, you will find many articles that say you can disable it by typing Set-MpPreference -DisableAutoExclusions $true in Powershell, but I could not reproduce it.

Get-Service WinDefend | Stop-Service -Force

FLARE-VM tries to disable it by running commands such as Get-Service WinDefend | Stop-Service -Force in Powershell, but as far as I could tell, I could not reproduce this either.

PS C:\> Get-Service WinDefend | Stop-Service -Force
Stop-Service : Service 'Microsoft Defender Antivirus Service (WinDefend)' cannot be stopped due to the following error:
Cannot open WinDefend service on computer '.'.
At line:1 char:25
+ Get-Service WinDefend | Stop-Service -Force
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (System.ServiceProcess.ServiceController:ServiceController) [Stop-Service],
ServiceCommandException
+ FullyQualifiedErrorId : CouldNotStopService,Microsoft.PowerShell.Commands.StopServiceCommand

Enable Turn off Microsoft Defender Antivirus in Group Policy

There are some articles that say you can disable it by enabling Turn off Microsoft Defender Antivirus in Group Policy, but as far as I checked, it was forced to be changed to unconfigured by rebooting, so I could not disable it in the way I wanted.

Add DisableAntiSpyware to the registry.

There are some articles that say you can disable it by adding DisableAntiSpyware to the registry, but as far as I checked, I was not able to reproduce it. (There are articles that say that the specifications have been changed so that this will not work.)

Original Article

Update History

  • 2021/02/15 New.

--

--

soji256

Loves cats and CTFs. …ᓚᘏᗢ… [twitter:@soji256] ,CISSP