Skip to content

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Fix-SecHealthUI

English | Türkçe | Русский

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".

Symptoms it fixes

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

What it does

  1. Admin check — re-launches elevated if needed
  2. Diagnosis — package registration, crash test, service state
  3. Clears broken state — AppX registration + AppModel registry
  4. Repairs services — starts disabled Defender services, clears DisableAntiSpyware policy
  5. Repairs system files (when needed) — sfc /scannow, then DISM /RestoreHealth
  6. Re-registers the package — from WindowsApps, falls back to SystemApps
  7. Verifies — exe stays alive 5s, windowsdefender: protocol opens
  8. Logs everything — SecHealthUI_FixLog.txt next to the script

Usage

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.ps1

Option 3 — Direct

powershell -NoProfile -ExecutionPolicy Bypass -File ".\Fix-SecHealthUI.ps1"

Exit codes

Code Meaning
0 Success (or partial — exe runs)
1 Failed — check SecHealthUI_FixLog.txt

Requirements

  • Windows 10 (19041+) or Windows 11
  • Administrator (script self-elevates)
  • PowerShell 5.1+

Manual fallback

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

Notes

  • 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.

License

MIT