> For the complete documentation index, see [llms.txt](https://squid22.gitbook.io/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://squid22.gitbook.io/notes/windows-1/privesc/disable-windows-defender.md).

# Disable Windows Defender

## Powershell

```bash
# To disable real-time monitoring of Windows Defender, run the following command:
Set-MpPreference -DisableRealtimeMonitoring $true

# To enable real-time monitoring, run the following command:
Set-MpPreference -DisableRealtimeMonitoring $false

# MpCmdRun.exe
"C:\Program Files\Windows Defender\MpCmdRun.exe" -RemoveDefinitions -All -DisableIOAVProtection $true   
```

## Command Prompt

```bash
# Run the following command to disable Windows Defender:
sc stop WinDefend

# To enable Windows defender again, run the following command:
sc start WinDefend

# Please note that this is a temporary method to stop Windows Defender. 
# The service will return to its original state when the system is restarted. 
# To disable Windows Defender permanently using command prompt, run the following command:

sc config WinDefend start= disabled
sc stop WinDefend

# To enable it again on startup, run the following commands:

sc config WinDefend start= auto
sc start WinDefend

# If you want to check the current state of Windows Defender service, run the following command:   

sc query WinDefend
```
