How to disable virus and threat protection in Windows Server?

In earlier versions of Windows Server, antivirus settings were only accessible via PowerShell. Now, you can also manage them through the graphical interface: Windows Settings → Windows Security → Virus & threat protection.

If you prefer the command line, open PowerShell as Administrator and run:

Set-MpPreference -DisableRealtimeMonitoring $true.

To re-enable virus and threat protection, run:

Set-MpPreference -DisableRealtimeMonitoring $false.

Both methods—GUI and command line—are fully functional.

Updated Date 29.12.2025