0X80040151

REGDB_E_WRITEREGDB (0X80040151) — Fix Fast

Database Errors Intermediate 👁 0 views 📅 May 26, 2026

That registry write error stops installations cold. Here's the fix that works 90% of the time, plus why it happens.

Seeing REGDB_E_WRITEREGDB (0X80040151) is maddening — you're trying to install something, and Windows slams the door. I've seen this hundreds of times. Don't go digging through the Event Viewer yet. The real fix is usually simpler than you think.

The Fast Fix: Run the Installer as Administrator

  1. Right-click your installer file (setup.exe, msi, or whatever you're running).
  2. Choose Run as administrator from the context menu.
  3. Click Yes on the User Account Control prompt.
  4. Proceed with the installation normally. After you click Install, you should see the progress bar move without the error.

This works because the installer needs write access to HKEY_CLASSES_ROOT and HKEY_LOCAL_MACHINE\SOFTWARE, which your normal user account doesn't have by default. Running as admin gives it the keys to the castle.

If That Didn't Work — Check Registry Permissions

Sometimes even admin rights aren't enough. A previous program or a security tool might have locked down a specific key. Here's how to check.

Step 1: Find the Offending Key

The error message usually tells you the exact key it couldn't write. Look for something like "Could not write key to registry HKCR\SomeApp.ProgID". If it doesn't show, open Event Viewer (press Win + R, type eventvwr.msc, hit Enter). Go to Windows Logs » Application and look for an error entry with the same 0X80040151 code. That entry will name the key.

Step 2: Take Ownership and Fix Permissions

  1. Press Win + R, type regedit, hit Enter. Click Yes on the UAC prompt.
  2. Navigate to the key from the error message. For example: Computer\HKEY_CLASSES_ROOT\SomeApp.ProgID.
  3. Right-click that key, choose Permissions.
  4. In the Permissions window, click Advanced.
  5. Next to Owner, click Change.
  6. Type Administrators in the box, click Check Names (it should underline it), then OK.
  7. Check the box Replace owner on subcontainers and objects, click Apply, then OK.
  8. Back in the Permissions window, select Administrators, and make sure Full Control is allowed. Click OK.
  9. Close Registry Editor, then run the installer again as administrator.

Less Common Variations

Sometimes the issue isn't a single key — it's a whole hive corruption. Here's what I've seen in the field.

Variation 1: DCOM Permission Denied

Some installers that register COM objects (like Microsoft Office or Visual Studio) trip over DCOM permissions. The fix: Open Component Services (type dcomcnfg in Run). Expand Component Services » Computers » My Computer » DCOM Config. Find the component related to your installer, right-click, choose Properties. Go to the Security tab, under Launch and Activation Permissions, choose Customize, click Edit, add Administrators, and allow Local Launch and Local Activation. Apply, then try again.

Variation 2: Third-Party Antivirus Blocking Registry Writes

McAfee, Norton, and even some free tools like Malwarebytes can intercept registry writes for "protection." Temporarily disable the real-time protection (not the whole product — just file and registry scanning). Don't forget to re-enable it after the install.

Variation 3: Group Policy Restrictions

If you're on a company machine, an IT policy might restrict registry writes. Open Local Group Policy Editor (type gpedit.msc in Run). Go to Computer Configuration » Administrative Templates » System » Registry. Look for policies that prevent registry write access. If you see anything enabled that restricts writes to HKCR or HKLM, you'll need an admin to change that.

Why This Error Happens

The registry isn't some chaotic mess — it's a tree. Each key has an owner, permissions, and audit settings. When the installer tries to create or modify a key, it needs Write permission. If the installer runs under a user account without those rights, or if a key's ACL has been tightened by a previous uninstall or a security product, Windows returns that 0X80040151 error. It's a permission problem, not a corruption problem. Treat it like a locked door — you just need the right key.

Prevention for Next Time

  • Always run installers as administrator. Even if you're an admin, Windows still applies filtering, so right-click and choose Run as administrator every time.
  • Uninstall properly. Use the app's own uninstaller rather than deleting files manually. That avoids orphaned registry entries with locked permissions.
  • Keep UAC on at default level. Turning UAC off makes things worse — it lets some apps run without elevation but leaves others confused. Stick with the default.
  • Scan for malware regularly. Some infections lock registry keys to prevent removal. A quick Malwarebytes scan before installing can save you an hour of troubleshooting.

The next time you see that 0X80040151 error, you'll know exactly where to look. Start with admin rights, then check the key, then look at DCOM and AV. That covers almost every case I've seen over the past decade.

Was this solution helpful?