Enable or Disable Windows Defender Using Shortcut or Command-line » Winhelponline.pdf

(378 KB) Pobierz
WINDOWS 10
MICROSOFT EDGE
MORE…
Enable or Disable Windows Defender Using
Shortcut or Command-line
0
Search this site
Custom Search
Almost every aspect of Windows Defender can be managed or automated using the
MpCmdrun.exe
command-line tool and PowerShell cmdlets. There are times when you need
to temporarily disable your Windows Defender real-time protection on your test (non-
production) systems, and switch it back on after a few minutes. It takes several mouse clicks
to turn o /on the Windows Defender real-time protection through user interface.
This post explains how to create desktop shortcuts or command-line to enable or disable
Windows Defender quickly.
Note:
None of the following methods work if the
Tamper Protection
feature
is enabled in Windows Defender Settings.
Tamper Protection
prevents third-
party apps or scripts from modifying Windows Defender settings. The feature
was rst introduced in Windows 10
v1903
(19H1).
Enable or disable Windows Defender using shortcut,
command-line or script
Method 1: Using separate shortcuts to enable and disable Defender
You can disable Windows Defender real-time protection using this PowerShell command:
powershell.exe -command "Set-MpPreference -DisableRealtimeMonitoring $true"
After you run the above command from an
elevated Command Prompt
or
Run dialog
(elevated),
it disables real-time protection component of Windows Defender. Following that,
you’ll immediately see the “Virus
& threat protection”
action center noti cation.
And to enable the real-time protection back, use this command-line:
powershell.exe -command "Set-MpPreference -DisableRealtimeMonitoring $false"
The above commands need to be run elevated (run as administrator).
You can create separate desktop shortcuts to the above commands
and run them as required. Make sure you run the shortcut using the
Run as administrator option in the right-click menu. Alternately, you
can con gure the shortcut properties so that they run elevated every
time.
Method 2: Using a PowerShell script le (.ps1) to toggle Defender real-
time protection setting
This method uses a simple PowerShell script, which when run, toggles the Windows Defender
real-time protection setting. If it’s turned o , the script turns it back on, and vice versa. So,
you’ll need just
one shortcut
if using this method.
1. Copy the following lines to Notepad:
$preferences = Get-MpPreference
Set-MpPreference -DisableRealtimeMonitoring (!$preferences.DisableRealtimeMonitorin
2. Save the le with a
.ps1
extension, in a permanent location. Let’s say
d:\tools\defender-realtime-toggle.ps1
3. Create a desktop shortcut with the following command:
powershell.exe -ExecutionPolicy Bypass -File "D:\Tools\defender-realtime-toggle.ps1
That’s it! As always, whenever you plan to run the shortcut/script, you need to run it elevated
(run as administrator.)
Other PowerShell cmdlets to manage Windows Defender
To know the complete list of PowerShell cmdlets for managing Windows Defender, check out Microsoft
docs article on
Defender-speci c PowerShell cmdlets.
We’ve seen PowerShell’s Defender-speci c cmdlets earlier in our earlier articles mentioned below:
1.
What is Controlled Folder Access in Windows 10 and How to Con gure it?
2.
Enable or Disable “Controlled Folder Access” Quickly Using Shortcuts
3.
How to Enable PUA, PUP or Adware Protection in Windows Defender?
4.
Windows Defender O ine Scan in Windows 10 Eliminates Complex Malware
Hope you liked the shortcut or command-line method to enable and disable Windows
Defender real-time protection on your computer.
One small request: If you liked this post, please share this?
One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
Pin it!
Share it to your favorite blog + Facebook, Reddit
Tweet it!
So thank you so much for your support, my reader. It won't take more than 10 seconds of your time. The share buttons are
right below. :)
You'd like to read these articles:
Block Crapware or Adware (PUA) using Windows Defender's Secret Feature
How to Con gure Controlled Folder Access to Stop "Unauthorized changes blocked"
Noti cations
How to Enable Adware or PUA Protection in Microsoft Security Essentials
Why Is Windows Defender Running Alongside my Antivirus Program?
Windows Defender Error loading type library/DLL (0x80029c4a) in Windows 10
About the author
Ramesh Srinivasan founded Winhelponline.com back in 2005. He is passionate about Microsoft
technologies and he has been a Microsoft Most Valuable Professional (MVP) for 10 consecutive years
from 2003 to 2012.
Microsoft
>
Windows
>
Windows 10
> Enable or Disable Windows Defender Using Shortcut or Command-line
Leave a Comment
Name *
Email *
Post Comment
About us
|
Contact us
|
Disclaimer & Terms of Use
|
Privacy Policy
Copyright© 2019 Ramesh Srinivasan
o
o
a
a
j
j
s
s
SHARES
Articles of Interest
OneDrive Files On-Demand Downloads - Block and
Unblock Apps via Settings
[Fix] Turn Windows Features On Or O is Empty in
Windows 10
Limit Windows Update Bandwidth for Background
Downloads in Windows 10
How to Take a Screenshot in Windows 10
Get Windows 10 O cial ISO Images Using Media
Creation Tool or Direct Download
Find the Windows version, build and edition from ISO
or DVD
Cannot Save Files to Desktop and Error "File not
found" in Windows 10
How to Enable Blue Light Reduction in Windows 10?
Restore or Reinstall Windows Store in Windows 10
after uninstalling it with PowerShell
Windows 10: Latest Cumulative Update Direct
Download Links
report this ad
0
SHARES
Zgłoś jeśli naruszono regulamin