Skip to content

w1zardz/windows-defender-antimalware-disable-toggle-win11

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Windows Defender Antimalware Service Executable — Disable Toggle for Windows 11

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.

Why You Need This

  • 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

How It Works

  1. Script monitors for a target process (default: obs64.exe)
  2. When the process starts → disables Defender real-time protection
  3. When the process stops → re-enables protection automatically
  4. On script exit (Ctrl+C, crash, etc.) → always re-enables protection (safety net)

Quick Start

Option 1: Double-click

Run run.bat — it launches the PowerShell script with Administrator privileges automatically.

Option 2: PowerShell

# Run as Administrator
.\defender-toggle.ps1

Custom Process

# 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 10

Prerequisites

Disable Tamper Protection

Windows 11 Tamper Protection blocks scripts from modifying Defender settings. You need to disable it once:

  1. Open Settings
  2. Go to Privacy & SecurityWindows Security
  3. Click Virus & threat protection
  4. Under Virus & threat protection settings, click Manage settings
  5. Set Tamper Protection to Off

The script will warn you if Tamper Protection is still enabled.

Supported Processes

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

Parameters

Parameter Default Description
-ProcessName obs64 Process name to monitor (without .exe)
-CheckInterval 5 Seconds between each check

Compatibility

  • Windows 11 (22H2, 23H2, 24H2)
  • Windows 10 (1903+)
  • PowerShell 5.1+
  • Requires Administrator privileges

FAQ

Is it safe?

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.

Will Windows re-enable Defender automatically?

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.

Does it work with Windows Security notifications?

You may see a notification that real-time protection is off. This is expected behavior while streaming.


Отключение Antimalware Service Executable при стриминге — Windows 11

Автоматическое отключение защиты Windows Defender в реальном времени во время стрима или игры. Защита включается обратно, когда целевой процесс завершается.

Antimalware Service Executable (MsMpEng.exe) вызывает высокую нагрузку на процессор, дропы кадров и фризы во время стримов через OBS и в играх. Этот скрипт следит за запущенным процессом (например, obs64.exe) и автоматически отключает сканирование Defender в реальном времени, пока процесс активен.

Зачем это нужно

  • Antimalware Service Executable грузит процессор во время стрима — вызывает пропуск кадров и лаги кодирования
  • Сканирование Windows Defender в реальном времени конфликтует с OBS Studio, Streamlabs и другим стриминговым софтом
  • Фризы и просадки FPS в играх из-за фоновых проверок Defender на Windows 11
  • Вручную переключать каждый раз — неудобно, этот скрипт автоматизирует всё

Как это работает

  1. Скрипт мониторит целевой процесс (по умолчанию: obs64.exe)
  2. Процесс запустился → отключает защиту Defender в реальном времени
  3. Процесс завершился → включает защиту обратно автоматически
  4. При выходе из скрипта (Ctrl+C, краш и т.д.) → всегда включает защиту обратно (страховка)

Быстрый старт

Вариант 1: Двойной клик

Запустите run.bat — он автоматически запустит PowerShell-скрипт с правами администратора.

Вариант 2: PowerShell

# Запустить от имени администратора
.\defender-toggle.ps1

Свой процесс

# Следить за Streamlabs вместо OBS
.\defender-toggle.ps1 -ProcessName "streamlabs"

# Следить за любой игрой или приложением
.\defender-toggle.ps1 -ProcessName "vlc"

# Изменить интервал проверки (по умолчанию 5 секунд)
.\defender-toggle.ps1 -ProcessName "obs64" -CheckInterval 10

Предварительная настройка

Отключение Tamper Protection (Защита от подделки)

Windows 11 Tamper Protection блокирует скриптам изменение настроек Defender. Нужно отключить один раз:

  1. Откройте Параметры
  2. Перейдите в Конфиденциальность и защитаБезопасность Windows
  3. Нажмите Защита от вирусов и угроз
  4. В разделе Параметры защиты от вирусов и угроз нажмите Управление настройками
  5. Установите Защита от подделки в Откл.

Скрипт предупредит вас, если 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 сам включит Defender обратно?

Windows 11 может включить защиту в реальном времени после перезагрузки или Windows Update. Скрипт это учитывает — он устанавливает настройку каждый раз, когда обнаруживает целевой процесс.

Будут ли уведомления от Безопасности Windows?

Может появиться уведомление, что защита в реальном времени отключена. Это нормальное поведение во время стрима.

Лицензия

MIT

Releases

No releases published

Packages

 
 
 

Contributors