Fix Service Control Error 0X00000887 (NERR_ServiceEntryLocked)
Error 0X00000887 means the Service Control Manager can't process a lock command on a service. Here's how to fix it fast.
What This Error Means (and what not to do)
Error code 0X00000887 (decimal 2185 for those keeping score) is the Windows Service Control Manager's way of saying "this service's control entry is locked right now." It pops up when you try to stop, restart, or reconfigure a service using net stop, sc control, or the Services GUI, and the SCM is already processing a start or stop command for that same service.
I've seen this most often after a service fails to start cleanly — it leaves the lock behind. Also common when someone clicks "Restart" in Services.msc before the previous stop finishes. It's not a corruption. It's a timing problem, and you can fix it without rebooting.
Fix #1: The 30-Second Check — Wait and Retry
This is the honest fix: just wait. Give the SCM 30 seconds to clear the lock on its own.
- Open a Command Prompt as Admin. Right-click Start, choose "Command Prompt (Admin)" or "Windows Terminal (Admin)".
- Type
sc queryex <servicename>. Replace <servicename> with the actual service name. For example:sc queryex spoolerfor the Print Spooler. - Look at the STATE output. If it says "STOP_PENDING" or "START_PENDING", the lock is normal — the service is still transitioning. Wait 15 seconds and run the query again.
- Once STATE shows "STOPPED" or "RUNNING", try your original command again.
Expected outcome: After 30-60 seconds, the lock clears automatically. If it doesn't, move to Fix #2.
Fix #2: The 5-Minute Fix — Kill the Stuck Process
Skip this if the service is critical to your system (like RpcSs). This works when the service's process is hung and won't respond to SCM commands.
- First, find the PID. Run
sc queryex <servicename>and note the PID number under STATE. - If the PID is 0, the service process is already dead — jump to Fix #3.
- If PID is something like 1234, open Task Manager (Ctrl+Shift+Esc) or run
taskkill /f /pid 1234from an Admin Command Prompt. - After killing it, run
sc queryex <servicename>again. You should see STATE = STOPPED and PID = 0. - Now the lock is gone. Start the service with
net start <servicename>orsc start <servicename>.
Expected outcome: The process ends, SCM releases the lock, and you can control the service again. If the PID was 0 already, you need the next fix.
Fix #3: The 15+ Minute Fix — Clear the Lock from the Registry
This is the nuclear option, and it's the real fix for error 0X00000887 when the service process is already dead but the SCM still thinks it's locked. This happens when a service crashes cleanly but the SCM doesn't get the message. Happens on Windows Server 2016 and 2019 more than 10 or 11, but I've seen it on both.
You're editing the registry. Back it up first if you're nervous.
- Open Regedit as Admin. Type
regeditin the Start menu, right-click, choose "Run as administrator". - Go to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<servicename>. - On the right, look for a value named
Start. Double-click it. Write down the current value — you might need it later. Usually it's 2 (Automatic), 3 (Manual), or 4 (Disabled). - Change the
Startvalue to 4 (Disabled). Click OK. - Close Regedit. Open an Admin Command Prompt.
- Run
sc query <servicename>. It should say STATE = STOPPED. If it still says START_PENDING or STOP_PENDING, reboot the machine. The lock will be gone after reboot. - Once the service is stopped, change the Start value back to its original number (2, 3, or whatever you wrote down).
- Now start the service:
net start <servicename>.
Expected outcome: The service starts cleanly. The error 0X00000887 won't appear again unless you have a deeper problem like a corrupted service binary or a driver conflict.
What If None of These Work?
If you're still seeing 0X00000887 after all three fixes, you've got something more serious. Check the System Event Log (Event Viewer > Windows Logs > System) for events from source "Service Control Manager" around the time the error appears. Look for event ID 7034 (service crashed unexpectedly) or 7000 (service failed to start).
Also check for antivirus software interfering. I've seen Symantec Endpoint Protection and McAfee lock service entries on Server 2012 R2. Temporarily disable the AV and see if the error goes away.
Last resort: run sfc /scannow from an Admin Command Prompt to check for system file corruption. Then dism /online /cleanup-image /restorehealth. These rarely fix this specific error, but they rule out bigger problems.
If you're still stuck, post the exact service name, the full error message, and any event IDs from the System log. I'll help you nail it down.
Was this solution helpful?