Useful commands to defend Microsoft Defender

Factory Reset Microsoft Defender

cmd /c "C:\Program Files\Windows Defender\MpCmdRun.exe" -RemoveDefinitions -All Set-MpPreference -DisableIOAVProtection $true

Add an Exception to a Directory or Process

Add-MpPreference -ExclusionPath "C:\"
Add-MpPreference -ExclusionProcess "c:\internal\test.exe"

Disable Real Time Protection

Set-MpPreference -DisableRealtimeMonitoring $true

Disable Cloud Protection

Set-MpPreference -DisableBlockAtFirstSeen $true

Disable Behavior Monitoring

Set-MpPreference -DisableBehaviorMonitoring $true