Open powershell as administrator

Set-MpPreference -DisableRealtimeMonitoring $true

Set-MpPreference -DisableRealtimeMonitoring $false

For more information

https://superuser.com/questions/1046297/how-do-i-turn-off-windows-defender-from-the-command-line