Saturday, 9 September 2017

Toggle Windows Defender real time protection via Desktop shortcut


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?



Answer



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, choose "New" and then "Shortcut" 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.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...