Created
December 7, 2022 17:57
-
-
Save iexpurgator/e593f3dab2e2a710ddb0e268decc781d to your computer and use it in GitHub Desktop.
Simple windows defender toggle
This file contains 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
## Shortcut (Administrator): powershell.exe -ExecutionPolicy Bypass -File "<full path>\windef_toggle.ps1" | |
$preferences = Get-MpPreference | |
$realtimeDisableStatus = $preferences.DisableRealtimeMonitoring | |
# Set-MpPreference -DisableRealtimeMonitoring (!$preferences.DisableRealtimeMonitoring) | |
if ($realtimeDisableStatus) { # Disabled -> Enable | |
Set-MpPreference -DisableRealtimeMonitoring $false | |
Set-MpPreference -MAPSReporting Advanced | |
Set-MpPreference -SubmitSamplesConsent 1 | |
Set-MpPreference -DisableBehaviorMonitoring $false | |
} else { # Enable -> Disabled | |
Set-MpPreference -DisableRealtimeMonitoring $true | |
Set-MpPreference -MAPSReporting Disabled | |
Set-MpPreference -SubmitSamplesConsent 2 | |
Set-MpPreference -DisableBehaviorMonitoring $true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment