Automatically disable Windows Defender real-time protection while streaming or gaming. Re-enables protection when the target process exits.
Antimalware Service Executable (MsMpEng.exe) causes high CPU usage, frame drops, and stuttering during OBS streaming and gaming sessions. This script monitors for a running process (e.g., obs64.exe) and toggles Defender's real-time scanning off while it's active.
- Antimalware Service Executable high CPU during streams — causes dropped frames and encoding lag
- Windows Defender real-time scanning conflicts with OBS Studio, Streamlabs, and other streaming software
- Game stuttering and FPS drops caused by background Defender scans on Windows 11
- Manual toggling is tedious — this script automates it completely
- Script monitors for a target process (default:
obs64.exe) - When the process starts → disables Defender real-time protection
- When the process stops → re-enables protection automatically
- On script exit (Ctrl+C, crash, etc.) → always re-enables protection (safety net)
Run run.bat — it launches the PowerShell script with Administrator privileges automatically.
# Run as Administrator
.\defender-toggle.ps1# Monitor Streamlabs instead of OBS
.\defender-toggle.ps1 -ProcessName "streamlabs"
# Monitor any game or app
.\defender-toggle.ps1 -ProcessName "vlc"
# Change check interval (default 5 seconds)
.\defender-toggle.ps1 -ProcessName "obs64" -CheckInterval 10Windows 11 Tamper Protection blocks scripts from modifying Defender settings. You need to disable it once:
- Open Settings
- Go to Privacy & Security → Windows Security
- Click Virus & threat protection
- Under Virus & threat protection settings, click Manage settings
- Set Tamper Protection to Off
The script will warn you if Tamper Protection is still enabled.
Works with any process. Common use cases:
| Process | -ProcessName value |
|---|---|
| OBS Studio | obs64 (default) |
| Streamlabs | streamlabs |
| XSplit | XSplit.Core |
| NVIDIA ShadowPlay | nvcontainer |
| Any game / app | use the .exe name without extension |
| Parameter | Default | Description |
|---|---|---|
-ProcessName |
obs64 |
Process name to monitor (without .exe) |
-CheckInterval |
5 |
Seconds between each check |
- Windows 11 (22H2, 23H2, 24H2)
- Windows 10 (1903+)
- PowerShell 5.1+
- Requires Administrator privileges
Yes. The script only disables real-time monitoring temporarily. Defender is fully re-enabled when the target process closes or the script exits. Your system is protected at all other times.
Windows 11 may re-enable real-time protection after a reboot or Windows Update. The script handles this — it sets the preference each time the target process is detected.
You may see a notification that real-time protection is off. This is expected behavior while streaming.
Автоматическое отключение защиты Windows Defender в реальном времени во время стрима или игры. Защита включается обратно, когда целевой процесс завершается.
Antimalware Service Executable (MsMpEng.exe) вызывает высокую нагрузку на процессор, дропы кадров и фризы во время стримов через OBS и в играх. Этот скрипт следит за запущенным процессом (например, obs64.exe) и автоматически отключает сканирование Defender в реальном времени, пока процесс активен.
- Antimalware Service Executable грузит процессор во время стрима — вызывает пропуск кадров и лаги кодирования
- Сканирование Windows Defender в реальном времени конфликтует с OBS Studio, Streamlabs и другим стриминговым софтом
- Фризы и просадки FPS в играх из-за фоновых проверок Defender на Windows 11
- Вручную переключать каждый раз — неудобно, этот скрипт автоматизирует всё
- Скрипт мониторит целевой процесс (по умолчанию:
obs64.exe) - Процесс запустился → отключает защиту Defender в реальном времени
- Процесс завершился → включает защиту обратно автоматически
- При выходе из скрипта (Ctrl+C, краш и т.д.) → всегда включает защиту обратно (страховка)
Запустите run.bat — он автоматически запустит PowerShell-скрипт с правами администратора.
# Запустить от имени администратора
.\defender-toggle.ps1# Следить за Streamlabs вместо OBS
.\defender-toggle.ps1 -ProcessName "streamlabs"
# Следить за любой игрой или приложением
.\defender-toggle.ps1 -ProcessName "vlc"
# Изменить интервал проверки (по умолчанию 5 секунд)
.\defender-toggle.ps1 -ProcessName "obs64" -CheckInterval 10Windows 11 Tamper Protection блокирует скриптам изменение настроек Defender. Нужно отключить один раз:
- Откройте Параметры
- Перейдите в Конфиденциальность и защита → Безопасность Windows
- Нажмите Защита от вирусов и угроз
- В разделе Параметры защиты от вирусов и угроз нажмите Управление настройками
- Установите Защита от подделки в Откл.
Скрипт предупредит вас, если Tamper Protection всё ещё включена.
Работает с любым процессом. Типичные варианты:
| Программа | Значение -ProcessName |
|---|---|
| OBS Studio | obs64 (по умолчанию) |
| Streamlabs | streamlabs |
| XSplit | XSplit.Core |
| NVIDIA ShadowPlay | nvcontainer |
| Любая игра / приложение | имя .exe без расширения |
| Параметр | По умолчанию | Описание |
|---|---|---|
-ProcessName |
obs64 |
Имя процесса для мониторинга (без .exe) |
-CheckInterval |
5 |
Интервал проверки в секундах |
- Windows 11 (22H2, 23H2, 24H2)
- Windows 10 (1903+)
- PowerShell 5.1+
- Требуются права Администратора
Да. Скрипт отключает только мониторинг в реальном времени и только временно. Defender полностью включается обратно, когда целевой процесс завершается или скрипт закрывается. В остальное время система полностью защищена.
Windows 11 может включить защиту в реальном времени после перезагрузки или Windows Update. Скрипт это учитывает — он устанавливает настройку каждый раз, когда обнаруживает целевой процесс.
Может появиться уведомление, что защита в реальном времени отключена. Это нормальное поведение во время стрима.
MIT