AutomoxAutomox

Worklet: Enable or disable Windows Defender

JasonG-Automox
October 11, 2019 at 3:28 pm UTC

This will disable or enable Windows Defender as easily as uncommenting the correct command and commenting out the opposite.

• Under Evaluation Code:

powershell8 lines
If (Test-Path "$env:allusersprofile\SoftwareDistribution")
{
Exit 0

}
Else {
Exit 1
}

• Under Remediation Code:

powershell7 lines
#To disable real-time monitoring of Windows Defender, run the following command:

Set-MpPreference -DisableRealtimeMonitoring $true

#To enable real-time monitoring, comment out the $true statement above then uncomment and run the following command:

#Set-MpPreference -DisableRealtimeMonitoring $false

This discussion is archived and closed to replies. Continue it in the Automox Community Slack.

Discuss on Slack