You can use PowerShell to enable and disable real-time antivirus protection provided you are running with full Administrator privileges. Temporarily disabling real-time antivirus protection may occasionally be helpful when there is explicit need to run legit scripts that may otherwise be blocked. Generally, real-time protection is valuable and should only be disabled with good cause.
To disable real-time protection, run this:
Set-MpPreference -DisableRealtimeMonitoring $true
To enable it, replace $true by $false.