Solution:
Root Cause: Unresponsive Background Applications and Excessive Service Termination Timeouts
When Windows initiates a shutdown, it sends a WM_QUERYENDSESSION message to all running applications and active background services, giving them a set time limit (controlled by
WaitToKillServiceTimeout) to save data and terminate threads. If a rogue background app or hung service fails to respond, Windows pauses the entire shutdown sequence for the full duration of the timeout window (defaulting to 5,000–20,000 milliseconds, or waiting indefinitely if applications hang), resulting in minutes of delay before the screen progresses.
Diagnostic Verification:
1Press Win + R, type eventvwr.msc, and press Enter.
2Expand Applications and Services Logs > Microsoft > Windows > Diagnostics-Performance > Operational.
3Filter current log for Event ID 200 (Boot Performance Monitoring) and Event ID 300 (Shutdown Performance Monitoring).
4Review the details pane: look for entries indicating that a specific application or service took excessive time to shut down (e.g., exceeding 10,000ms).
Step-by-Step Fix:
1Adjust Service Termination Timeouts in Registry:
Press Win + R, type regedit, and press Enter.Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control.Select the Control key, locate WaitToKillServiceTimeout in the right pane, right-click, and select Modify.Change the value data from 5000 (5 seconds) to 2000 (2 seconds) in decimal format.2Configure Hung App Auto-Kill Parameters:
Navigate to HKEY_CURRENT_USER\Control Panel\Desktop.Locate AutoEndTasks, modify its value from 0 to 1.Create or modify WaitToKillAppTimeout and set it to 2000.Create or modify HungAppTimeout and set it to 2000.3Restart Computer:
Reboot your PC to apply new process timeout thresholds.Prevention & Long-Term Monitoring:
Periodically audit background startup applications in Task Manager to prevent uncooperative software from lingering during sessions.