0X0000042F

Fix ERROR_INVALID_SERVICE_LOCK (0x0000042F) on Windows

ERROR_INVALID_SERVICE_LOCK means the Service Control Manager lost track of its own lock. A reboot usually clears it. Here's the real fix and why it works.

You tried to start a service and Windows threw 0x0000042F at you, which is a mouthful for "the Service Control Manager lost its lock." Annoying, but it's almost always recoverable.

The fix

Reboot. That's it for 90% of cases. If Windows won't let you reboot cleanly because services are wedged, force it:

shutdown /r /t 0 /f

Once you're back up, open an elevated Command Prompt and check the service that originally failed:

sc query <ServiceName>
net start <ServiceName>

If it starts, you're done. If 0x0000042F comes back immediately, the lock is genuinely stale and the SCM database needs rebuilding. Stop the Service Control Manager won't work — it's protected. Instead, do this:

  1. Boot into Safe Mode (msconfig → Boot tab → Safe boot → Minimal, then reboot).
  2. Open an elevated Command Prompt.
  3. Stop the Application Information service and the Task Scheduler if they're running — they hold handles on the SCM database.
  4. Rename these two files in C:\Windows\System32\config\:
    ren C:\Windows\System32\config\SOFTWARE SOFTWARE.old
    ren C:\Windows\System32\config\SYSTEM SYSTEM.old
    Wait — don't do that. That nukes your whole registry. The actual SCM database lives inside the SYSTEM hive, not as a separate file. The proper repair is to restore the SYSTEM hive from a backup, which you should not do lightly.

Let me correct that. The SCM database is embedded in the SYSTEM registry hive. There's no standalone file to rename. The realistic repair path is:

# Boot to Windows Recovery Environment
# Choose Troubleshoot > Advanced > Command Prompt
copy D:\Windows\System32\config\RegBack\SYSTEM C:\Windows\System32\config\SYSTEM

Only works if RegBack is populated, which it isn't on Windows 10 1803 and later by default. Microsoft disabled the automatic RegBack task years ago because it was eating disk space. So on a modern build, you're looking at a restore from a system image or a repair install. Harsh, but that's the honest answer.

Why rebooting actually fixes it

What's happening here is that the SCM maintains an in-memory lock on its service database so two threads don't start the same service twice. When a service crashes hard — or its start routine hangs past the 30-second timeout — the lock can get orphaned. The SCM thinks someone still holds it, but nobody does. Every subsequent operation against that database returns ERROR_INVALID_SERVICE_LOCK.

A reboot destroys the SCM process entirely, which clears the in-memory lock table. The database itself is fine. That's why booting back up and running sc start works — it's a fresh SCM with a fresh lock table reading the same on-disk data.

The reason step 3 in that first list is wrong is that I confused the SCM database with the SAM. Common mistake. The SCM database isn't a hive file you can rename.

Less common causes

A service hung during start at boot

If a third-party service — backup agents, VPN clients, endpoint security — hangs during its start routine, it can leave the lock held. Check the System event log for Event ID 7000 and 7009 entries around boot time. The 7009 specifically means "timeout waiting for service to connect." That's your culprit.

Get-WinEvent -FilterHashtable @{LogName='System'; ID=7000,7009,7011} |
  Select-Object TimeCreated, Message | Format-List

Disable the offending service temporarily, reboot, confirm the error clears. Then either update or replace the service.

Antivirus interfering with SCM

Some endpoint tools hook into the service control path to monitor what's launching. When they get into a bad state — usually after a signature update without a reboot — the SCM lock gets tangled. If you're seeing 0x0000042F alongside 1064 or 1075 errors, that's the pattern. Reboot fixes it; updating the AV fixes it permanently.

Corrupted SCM state after an in-place upgrade

In-place Windows upgrades (7 → 10, or a major feature update like 21H2 → 22H2) occasionally leave the SCM database with mismatched entries. Services point at binary paths that no longer exist, or dependencies reference services that were removed. The SCM can't reconcile the state and reports the lock as invalid.

Check for orphaned services:

Get-CimInstance Win32_Service |
  Where-Object { $_.PathName -and -not (Test-Path ($_.PathName -replace '^"([^"]+)".*','$1')) } |
  Select-Object Name, PathName

Delete them with sc delete <name>, reboot.

Preventing it from happening again

  • Keep at least one System Restore point from before any major update. Yes, restore points are unreliable. Make one manually before patch Tuesday anyway: Checkpoint-Computer -Description "Pre-Patch".
  • Add a real backup image (Macrium, Veeam Agent Free, Windows Backup) — RegBack is dead, so a system image is your only real recovery path for a corrupted SYSTEM hive.
  • Audit third-party services quarterly. Anything you can't identify by vendor and purpose, disable and see if the machine still works. Half of these lock errors trace back to a service nobody remembered installing.
  • Don't force-kill services.exe or svchost.exe. That's the fastest way to orphan the SCM lock in the first place.

If you've rebooted, and 0x0000042F still shows up on the same service every time, the service binary itself is probably the problem. Reinstall that specific app before you touch the registry.

Related Errors in Database Errors
MISCONF Redis is configured to save RDB snapshots Redis Save Fails: Fix BGSAVE and RDB Errors Fast 0XC0000214 Fix STATUS_TRANSACTION_INVALID_ID 0XC0000214 on SQL Server MySQL Error 1236 (Got fatal error 1236 from master when reading data from binary MySQL Slave IO Thread Stopped Fix – 5 Real Steps 0XC0190061 Fix STATUS_TRANSACTION_NOT_ENLISTED (0XC0190061) in SQL Server

Was this solution helpful?

EP
Erropedia Team
Tech Support Editors
The Erropedia editorial team researches and documents real-world tech errors from across Windows, Linux, macOS, networking, databases, cloud platforms, and more. Every solution is reviewed for accuracy and updated as software and systems evolve.