ERROR_MACHINE_LOCKED (0x000004F7) Fix: Stop the Stuck Shutdown
Your PC says it's locked and won't shut down without force. Here's why it happens and how to fix it—no fluff, just what works.
1. User Session is Still Active – The Most Common Cause
You hit shutdown, but Windows says the machine is locked. Nine times out of ten, this means someone's logged in remotely or a service is holding the session open. I had a client last month whose whole office couldn't shut down their POS systems because a remote admin session was lingering.
Check for active sessions:
- Press
Win + R, typecmd, hit Enter. - Run
query session. You'll see a list like this:
SESSIONNAME USERNAME ID STATE TYPE DEVICE
services 0 Disc
console jdoe 1 Active
rdp-tcp#1 smith 2 Active
If you see any session with STATE = Active besides your own console session, that's the culprit. Log off those sessions:
- For a remote desktop session:
logoff 2(replace 2 with the session ID from the second column). - If it's a console session you don't recognize, force it:
reset session 1– but only if you're sure no one's using it.
Once those extra sessions are gone, shutdown should work normally. No force needed.
2. Group Policy Blocks Shutdown from Locked State
Sometimes the issue isn't a session—it's a policy that says you can't shut down when the workstation is locked. This is common in corporate environments or domain-joined machines where IT tightened security. Saw this at a dental office last year; the receptionist couldn't shut down her PC because the policy was set to require explicit logoff.
Here's how to check and fix it:
- Press
Win + R, typegpedit.msc, hit Enter. (If you're on Windows Home, this won't work—skip to the registry fix below.) - Go to:
Computer Configuration → Administrative Templates → System → Shutdown Options. - Double-click
Turn off the ability to shut down the system from the locked screen. - Set it to Disabled or Not Configured. Click OK.
- Run
gpupdate /forcein an admin command prompt.
If you don't have gpedit.msc (Windows Home users), edit the registry directly:
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v ShutdownWithoutLogon /t REG_DWORD /d 0 /f
A value of 0 means you can shut down from the lock screen. Value 1 blocks it. Restart your PC after changing it.
3. Corrupted User Profile or Fast User Switching Glitch
Fast User Switching is a feature that sometimes breaks spectacularly. When a user switches accounts instead of logging off, Windows keeps the old session in a weird locked state. The shutdown command sees it and spits out 0x000004F7.
I've fixed this on a dozen machines by simply disabling Fast User Switching. Here's the cleanest way:
- Press
Win + R, typegpedit.msc, hit Enter. - Navigate to:
Computer Configuration → Administrative Templates → System → Logon. - Find
Hide entry points for Fast User Switching. Set it to Enabled. - Run
gpupdate /forceand reboot.
No gpedit? Use the registry:
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v HideFastUserSwitching /t REG_DWORD /d 1 /f
Still stuck after that? The user profile itself might be corrupted. Create a new local user account, move your files over, and delete the old profile. It's a pain, but it works when nothing else does.
Quick-Reference Summary Table
| Cause | Fix | Difficulty |
|---|---|---|
| Active user session (remote or console) | Run query session and logoff extra sessions | Beginner |
| Group policy blocks shutdown from lock screen | Set ShutdownWithoutLogon registry key to 0 | Intermediate |
| Fast User Switching glitch or corrupted profile | Disable Fast User Switching or create new user account | Intermediate |
Was this solution helpful?