One-file PowerShell script that repairs Windows Security (SecHealthUI.exe) when it won't open, crashes with 0xC0000409, or Windows says "You need a new app to open this windowsdefender link".
| Symptom | Cause |
|---|---|
SecHealthUI.exe exits with 0xC0000409 |
Stack buffer overrun in KERNELBASE.dll |
| "You need a new app to open this link" | Broken windowsdefender: protocol / AppX registration |
| Windows Security opens blank or not at all | Missing package registration or stuck AppModel state |
AppModel errors 0x490 / 0x20 |
Corrupted package runtime state |
| Defender services stopped or disabled | WinDefend, SecurityHealthService, wscsvc down |
- Admin check — re-launches elevated if needed
- Diagnosis — package registration, crash test, service state
- Clears broken state — AppX registration + AppModel registry
- Repairs services — starts disabled Defender services, clears
DisableAntiSpywarepolicy - Repairs system files (when needed) —
sfc /scannow, thenDISM /RestoreHealth - Re-registers the package — from
WindowsApps, falls back toSystemApps - Verifies — exe stays alive 5s,
windowsdefender:protocol opens - Logs everything —
SecHealthUI_FixLog.txtnext to the script
Option 1 — Right click
Right-click Fix-SecHealthUI.ps1 → Run with PowerShell (approve UAC)
Option 2 — Admin terminal
Set-ExecutionPolicy -Scope Process Bypass -Force
.\Fix-SecHealthUI.ps1Option 3 — Direct
powershell -NoProfile -ExecutionPolicy Bypass -File ".\Fix-SecHealthUI.ps1"| Code | Meaning |
|---|---|
0 |
Success (or partial — exe runs) |
1 |
Failed — check SecHealthUI_FixLog.txt |
- Windows 10 (19041+) or Windows 11
- Administrator (script self-elevates)
- PowerShell 5.1+
sfc /scannow
DISM /Online /Cleanup-Image /RestoreHealth
Add-AppxPackage -DisableDevelopmentMode -Register "C:\Windows\SystemApps\Microsoft.Windows.SecHealthUI_cw5n1h2txyewy\AppXManifest.xml"
Start-Service WinDefend, SecurityHealthService, wscsvc- Does not delete user files — only resets AppX registration and runs SFC/DISM if the binary is crash-looping.
- If a third-party antivirus is installed, it may take over security UI; Windows Security may still open but show limited options. Normal.
- If
MsMpEng.exe(Defender engine) itself is broken, run Windows Update or Settings → System → Recovery → Fix problems using Windows Update.
MIT