Created
July 21, 2021 08:03
-
-
Save Davidblkx/86bfaa1f863f13d7e606c89c6990d2b7 to your computer and use it in GitHub Desktop.
Enable disable windows defender real time protection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) | |
{ | |
$arguments = "& '" +$myinvocation.mycommand.definition + "'" | |
Start-Process powershell -Verb runAs -ArgumentList $arguments | |
Break | |
} | |
$status = (-Not (Get-MpPreference).DisableRealtimeMonitoring) | |
Set-MpPreference -DisableRealtimeMonitoring $status | |
$status |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment