Disable Defender Antivirus service automatic launch
- Windows onlyThis script improves your privacy on Windows
- Single actionThis page belongs to a script, containing basic changes to achieve a task.
- Impact: High
System Functionality / Data Loss Risk: High
This action improves privacy with high impact when you run the recommended script.
- Batch (batchfile)These changes use Windows system commands to update your settings.
- Administrator rights requiredThis script requires privilege access to do the system changes
- Fully reversible
You can fully restore this action (revert back to the original behavior) using this website.
The restore/revert methods provided here can help you fix issues.
Overview
This script prevents the Defender Antivirus service from starting automatically.
By default, Windows may automatically start the Defender Antivirus service (also called the Antimalware Service 1) under specific conditions 2 3. This script allows you to control when the service runs.
This script enhances privacy by preventing unexpected Defender Antivirus scans and data collection. It may improve system performance by stopping the service from using system resources without your permission.
However, it may reduce security by stopping Defender Antivirus from automatically activating against potential threats.
Disabling automatic launch may leave your system vulnerable if you forget to manually activate Defender Antivirus when needed.
Technical Details
This script sets the ServiceStartStates
registry value to 0
in the Defender Antivirus registry key:
0
indicates the service is turned off and won't start automatically;1
means it will 4.- When a third-party antivirus is installed, Windows typically sets this value to
0
2. - Default values can vary; tests show that it is missing in fresh installations of both Windows 11 and Windows 10 5.
- The
MpSvc.dll
6 andMpClient.dll
7 files read this registry value to manage Defender Antivirus operations.
- Not Advised
This script should only be used by advanced users.
This script is not recommended for daily use as it breaks important functionality.
Consider creating a system restore point before doing any changes.
- Security Trade-off
This action prioritizes privacy over certain security features. It's not recommended and should only be used by advanced users after understanding its implications.
Increased Privacy
Enhanced privacy through reduced data collection and trackingDecreased Security
Some security features will be disabled or limitedThis script can be reversed, this action allows you to can restore the system security.
Sources
- Microsoft Defender Antivirus in Windows Overview - Microsoft Defender for Endpoint. Microsoft Learn. learn.microsoft.com. (2024).
Original: https://learn.microsoft.com/en-us/defender-endpoint/microsoft-defender-antivirus-windows
Archived: https://web.archive.org/web/20240609145624/https://learn.microsoft.com/en-us/defender-endpoint/microsoft-defender-antivirus-windows?view=o365-worldwide - Defender detects but can't clean - Trojan:O97M/Mountsi.C!ml - Page 2 - Virus, Trojan, Spyware, and Malware Removal Help. www.bleepingcomputer.com. (2024).
Original: https://www.bleepingcomputer.com/forums/t/770901/defender-detects-but-cant-clean-trojano97mmountsicml/page-2
Archived: https://web.archive.org/web/20240925233603/https://www.bleepingcomputer.com/forums/t/770901/defender-detects-but-cant-clean-trojano97mmountsicml/page-2#entry5354622 - Turn off Defender antivirus protection in Windows Security - Microsoft Support. (2024).
Original: https://support.microsoft.com/en-us/windows/turn-off-defender-antivirus-protection-in-windows-security-99e6004f-c54c-8509-773c-a4d776b77960
Archived: https://web.archive.org/web/20240409171447/https://support.microsoft.com/en-us/windows/turn-off-defender-antivirus-protection-in-windows-security-99e6004f-c54c-8509-773c-a4d776b77960 - Windows Defender randomly turning off sometimes. www.windowsphoneinfo.com. (2024).
Original: https://www.windowsphoneinfo.com/threads/windows-defender-randomly-turning-off-sometimes.383757
Archived: https://web.archive.org/web/20240925233249/https://www.windowsphoneinfo.com/threads/windows-defender-randomly-turning-off-sometimes.383757/ - 10_0_22622_601/C/Windows/WinSxS/amd64_windows-defender-service_31bf3856ad364e35_10.0.22621.1_none_273bee824a8ac431/MpSvc.dll.strings at c598035e1a6627384d646140fe9e4d234b36b11d · privacysexy-forks/10_0_22622_601. github.com. (2024).
Original: https://raw.githubusercontent.com/privacysexy-forks/10_0_22622_601/c598035e1a6627384d646140fe9e4d234b36b11d/C/Windows/WinSxS/amd64_windows-defender-service_31bf3856ad364e35_10.0.22621.1_none_273bee824a8ac431/MpSvc.dll.strings
Archived: https://web.archive.org/web/20240917123620/https://raw.githubusercontent.com/privacysexy-forks/10_0_22622_601/c598035e1a6627384d646140fe9e4d234b36b11d/C/Windows/WinSxS/amd64_windows-defender-service_31bf3856ad364e35_10.0.22621.1_none_273bee824a8ac431/MpSvc.dll.strings - 10_0_22623_1020/C/Windows/WinSxS/wow64_windows-defender-service_31bf3856ad364e35_10.0.22621.1_none_319098d47eeb862c/MpClient.dll.strings at 0225ce2c6d74641e63613c0a57c5c6ebea2df4d8 · privacysexy-forks/10_0_22623_1020. raw.githubusercontent.com. (2024).
Original: https://raw.githubusercontent.com/privacysexy-forks/10_0_22623_1020/0225ce2c6d74641e63613c0a57c5c6ebea2df4d8/C/Windows/WinSxS/wow64_windows-defender-service_31bf3856ad364e35_10.0.22621.1_none_319098d47eeb862c/MpClient.dll.strings
Archived: https://archive.ph/2024.10.29-181420/https://raw.githubusercontent.com/privacysexy-forks/10_0_22623_1020/0225ce2c6d74641e63613c0a57c5c6ebea2df4d8/C/Windows/WinSxS/wow64_windows-defender-service_31bf3856ad364e35_10.0.22621.1_none_319098d47eeb862c/MpClient.dll.strings - github.com. (2024).
Original: https://github.com/undergroundwires/privacy.sexy/issues/393
Archived: https://web.archive.org/web/20240926000343/https://github.com/undergroundwires/privacy.sexy/issues/393
Apply Now
Choose one of three ways to apply:
Download script
Download and run the script directly- No app needed
- Offline usage
- Easy-to-apply
- Free
- Open-source
Help
How to apply or restore "Disable Defender Antivirus service automatic launch" using script
- ≈ 2 min to complete
- Tools: Web Browser
- Difficulty: Simple
- ≈ 5 instructions
- 1
Download
Download the script file by clicking on thebutton above.
Use button above to restore changes. - 2
Keep the file
If warned by your browser, keep the file. - 3
Open
Open the downloaded file. - 4
Exit
Once it's done, press any key to exit the window. - 5
Restart
Restart your computer for all changes to take effect.
Apply with privacy.sexy
Guided, automated application with safety checks- Recommended for most users
- Includes safety checks
- Free
- Open-source
- Popular
- Offline/Online usage
Help
How to apply or restore "Disable Defender Antivirus service automatic launch" using privacy.sexy
- ≈ 3 min to complete
- Tools: privacy.sexy
- Difficulty: Simple
- ≈ 4 instructions
- 2
Choose script
- Search for the script name: Disable Defender Antivirus service automatic launch
- Check the script by clicking on the checkbox.
- 3
Run
Click on ▶️ Run button at the bottom of the page.This button only appears on desktop version (recommended). On browser, use 💾 Save button.
- Apply
- Revert
:: Set the registry value: "HKLM\SOFTWARE\Microsoft\Windows Defender!ServiceStartStates"
PowerShell -ExecutionPolicy Unrestricted -Command "function Invoke-AsTrustedInstaller($Script) { $principalSid = [System.Security.Principal.SecurityIdentifier]::new('S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464'); $principalName = $principalSid.Translate([System.Security.Principal.NTAccount]); $streamFile = New-TemporaryFile; $scriptFile = New-TemporaryFile; try { $scriptFile = Rename-Item -LiteralPath $scriptFile -NewName ($scriptFile.BaseName + '.ps1') -Force -PassThru; $Script | Out-File $scriptFile -Encoding UTF8; $taskName = "^""privacy$([char]0x002E)sexy invoke"^""; schtasks.exe /delete /tn $taskName /f 2>&1 | Out-Null; $executionCommand = "^""powershell.exe -ExecutionPolicy Bypass -File '$scriptFile' *>&1 | Out-File -FilePath '$streamFile' -Encoding UTF8"^""; $action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument "^""-ExecutionPolicy Bypass -Command `"^""$executionCommand`"^"""^""; $settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries; Register-ScheduledTask -TaskName $taskName -Action $action -Settings $settings -Force -ErrorAction Stop | Out-Null; try { ($scheduleService = New-Object -ComObject Schedule.Service).Connect(); $scheduleService.GetFolder('\').GetTask($taskName).RunEx($null, 0, 0, $principalName) | Out-Null; $timeout = (Get-Date).AddMinutes(5); Write-Host "^""Running as $principalName"^""; while ((Get-ScheduledTaskInfo $taskName).LastTaskResult -eq 267009) { Start-Sleep -Milliseconds 200; if ((Get-Date) -gt $timeout) { Write-Warning 'Skipping: Timeout'; break; }; }; if (($result = (Get-ScheduledTaskInfo $taskName).LastTaskResult) -ne 0) { Write-Error "^""Failed, due to exit code: $result."^""; } } finally { schtasks.exe /delete /tn $taskName /f | Out-Null; }; Get-Content $streamFile } finally { Remove-Item $streamFile, $scriptFile; }; }; $cmd = '$registryPath = ''HKLM\SOFTWARE\Microsoft\Windows Defender'''+"^""`r`n"^""+'$data = ''0'''+"^""`r`n"^""+''+"^""`r`n"^""+'reg add ''HKLM\SOFTWARE\Microsoft\Windows Defender'' `'+"^""`r`n"^""+' /v ''ServiceStartStates'' `'+"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tZVwiXlwiXCI7IHdoaWxlICgoR2V0LVNjaGVkdWxlZFRhc2tJbmZvICR0YXNrTmFtZSkuTGFzdFRhc2tSZXN1bHQgLWVxIDI2NzAwOSkgeyBTdGFydC1TbGVlcCAtTWlsbGlzZWNvbmRzIDIwMDsgaWYgKChHZXQtRGF0ZSkgLWd0ICR0aW1lb3V0KSB7IFdyaXRlLVdhcm5pbmcgJ1NraXBwaW5nOiBUaW1lb3V0JzsgYnJlYWs7IH07IH07IGlmICgoJHJlc3VsdCA9IChHZXQtU2NoZWR1bGVkVGFza0luZm8gJHRhc2tOYW1lKS5MYXN0VGFza1Jlc3VsdCkgLW5lIDApIHsgV3JpdGUtRXJyb3IgXCJeXCJcIkZhaWxlZCwgZHVlIHRvIGV4aXQgY29kZTogJHJlc3VsdC5cIl5cIlwiOyB9IH0gZmluYWxseSB7IHNjaHRhc2tzLmV4ZSAvZGVsZXRlIC90biAkdGFza05hbWUgL2YgfCBPdXQtTnVsbDsgfTsgR2V0LUNvbnRlbnQgJHN0cmVhbUZpbGUgfSBmaW5hbGx5IHsgUmVtb3ZlLUl0ZW0gJHN0cmVhbUZpbGUsICRzY3JpcHRGaWxlOyB9OyB9OyAkY21kID0gJ3JlZyBkZWxldGUgJydIS0xNXFxTT0ZUV0FSRVxcTWljcm9zb2Z0XFxXaW5kb3dzIERlZmVuZGVyJycgYCcrXCJeXCJcImByYG5cIl5cIlwiKycgICAgICAgIC92ICcnU2VydmljZVN0YXJ0U3RhdGVzJycgYCcrXCJeXCJcImByYG5cIl5cIlwiKycgICAgICAgIC9mIDI+JG51bGwnOyBJbnZva2UtQXNUcnVzdGVkSW5zdGFsbGVyICRjbWRcIiI=
Help
How to apply or restore "Disable Defender Antivirus service automatic launch" using commands
- ≈ 2 min to complete
- Tools: Command Prompt
- Difficulty: Medium
- ≈ 3 instructions
- 1
Open Command Prompt
Open Command Prompt as Administrator. - 2
Copy code
Copy the code: - 3
Paste & run
Paste the commands into Command Prompt and press Enter to run.Some changes require a system restart to take effect
Similar Guides
Wider Goal
Guides below includes this guide to achieve a wider goal.See other more general settings that includes this one as one of its actions.
These plans combine multiple privacy settings, including this one, for stronger protection.
- Disable Defender Antivirus service
- Disable Defender services and drivers
- Disable Defender Antivirus
- Disable Defender
- Privacy over security
This category disables the Defender Antivirus service and its related components. This service is also referred to as Microsoft Defender Antivirus Service and Wind...
This write-up —disable Defender services and drivers— provides guidance on how to secure your digital footprint via personal privacy maintenance on Windows. In dir...
This category provides scripts to disable Defender Antivirus. Defender Antivirus, integrated into Windows, provides protection against viruses, ransomware, and oth...
This category offers scripts to disable Windows security components related to Defender. Defender is also referred to as Microsoft Defender or Windows Defender. Al...
Steps to privacy over security on your Windows machine to enhance data privacy protection. Together with that, this feature walks through the procedure to undo the...
Same Goal
Other guides in Disable Defender Antivirus serviceSee settings that are in the same category as this guide.
Using other actions in the same category may help you achieve your goal better.
See all 10 guides
About the Creators
These people have authored this documentation and written its scripts:
Reviewed By
This guide has undergone comprehensive auditing and peer review:Expert review by undergroundwires
- Verified technical accuracy and editorial standards
- Assessed system impact and user privacy risks
Public review by large community
- Privacy enthusiasts and professionals peer-reviewed
- Millions of end-users tested across different environments
History
We continually monitor our guides, their impact and all other privacy options. We update our guides when new information becomes available. On every update, we publicly store who made the change, what has been changed, why the change was made and when the change was made.