Unfortunately sometimes it is needed to disable (and later enable again) the (excellent) Windows defender real time protection.

I require 7 clicks to enable or disable Defender real time protection: Systray -> double on icon -> "Virus & threat protection" -> "Virus & threat protection settings" -> Toggle "Real-time protection" -> User Account Control "Yes".

Is there a simpler way to create a desktop shortcut that minimizes the number of clicks needed?

  • I'd think you can maybe toggle a service, can you explain why you need to disable/enable it? – djsmiley2k Oct 5 '17 at 15:48
  • The process is requiring too much CPU, slowing processes stuff down. I couldn't find out which files/processes are causing this. See my related question: superuser.com/q/1256548/25933 – janpio Oct 5 '17 at 15:51
  • I doubt there will be such a simple way to disable Windows Defender. There is a reason for this. If there was a simple way to disable Windows Defender malware authors would know all about it and the protection it provides would be nullified. The interactive process used cannot be easily duplicated with software. The Windows Defender service cannot be directly stopped by even an elevated admin account. – LMiller7 Oct 5 '17 at 18:06
  • It actually can, but @djsmiley2k unfortunately posted the answer in the wrong question: superuser.com/a/1256561/25933 – janpio Oct 5 '17 at 18:15
  • Hahah thanks :D – djsmiley2k Oct 6 '17 at 14:30
up vote 1 down vote accepted

To actually toggle the real-time monitoring state put the following in a PowerShell script (must be run as administrator):

$preferences = Get-MpPreference
Set-MpPreference -DisableRealtimeMonitoring (!$preferences.DisableRealtimeMonitoring)

To make this into a desktop shortcut, right-click on the desktop and enter the following for the item (substituting the location of the script you created for the -File argument)

%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File "C:\Users\yuji\Documents\toggle-monitoring.ps1"

And in the Advanced options, enable Run as administrator.

  • 1
    You are absolutely right, this works perfect! Thank you. – janpio Jan 22 at 12:54

It seems you can do this in powershell:

Set-MpPreference -DisableRealtimeMonitoring $true

Obviously, set it to $false to turn it back on.

This answer on StackExchange discusses how to turn this into a shortcut if that's how you choose to proceed.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.