Regedit “Cannot Delete (keyname): Error while deleting key”

Posted on


I am trying to delete a registry key in regedit and keep getting this error:

Cannot delete (keyname): Error while deleting key.

I am an admin and have checked the permissions for the key and all parent and child keys. I have full control but the same error still shows.

Any help is appreciated.


You probably have to take ownership before you can delete the key. Right click on the key and click “Permissions…”, then Add. Type in your username then “Check Names”. Click OK. Then Click Advanced and then the Owner tab. Highlight your username and hit OK. You should now be able to check Full Control under the Allow column and from there actually delete the key.

You can also check the “Advanced” permissions with the list of “Permission entries” to see if there are any “Deny” types preventing deletion.
Delete this entry

I have found the answer. There was a driver preventing the deletion. I used the notepad backdoor to delete it (has not been tested on OS subsequent to Windows 7).

Note: If you already have a Windows Recovery drive, you can delete the driver by booting from the drive, opening the Command Prompt, and deleting it using some simple Batch commands (or starting notepad and navigating with an interface from Open on the file menu).


  1. Restart your computer.
  2. When you see the Starting Windows screen, force shutdown your computer.
  3. Start your computer.
  4. You should see a menu with a Launch Startup Repair (recommended) option. Select this.
  5. Startup Repair will now start. You will shortly see a window saying Do you want to restore your computer using System Restore?. Click cancel.
  6. Wait until another window pops up (this may take a while) that says Startup Repair cannot repair this computer automatically. Click on the View problem details drop-down.
  7. Scroll down to the last link (it should be a text file) and click on it.
  8. Once in notepad, click Open from the file menu. From there you have full access to your computer.

For deleting a driver, navigate to C:WindowsSystem32drivers and delete the driver you want.

If you know Batch, navigate to C:WidnowsSystem32 and right click on cmd.exe. Click Run as administrator.

These steps show how to take ownership of the registry key so it can be deleted.

  1. In Registry Editor window, Right-Click the key you want to delete, and select permissions

  2. On the window that appears, click the Advanced-button:

Advanced -button

  1. At the top of the next window you’ll see Owner: <USERNAME> Change – click Change.


  1. On the next screen, you’ll see a text entry field (1). Enter your username and click the Check Name -button (2) to see if it’s valid. If not, click (examples) -hyperlink to see examples valid searches; and retry. If your user is valid, click the OK -button (3) to continue.

User selection

  1. On the next window:
  • Check Replace owner on sub containers and objects (1)

  • Check Replace all child object permissions entries with inheritable permission entries from this object (2)

  • Click Apply (3)

  • Click OK (4)

Last steps

  1. Since you’ve now taken owership of the key you can delete it

The entire workflow is shown in this Youtube video.

I had a similar issue today when trying to kill/disable the service SBSCore. (which requires changes to the reg before the service itself can be disabled.) What it comes down to is that you might have the right permissions in place, but as long as that registry is running, that key/value might be locked in place.

In order to unlock the registry, I had to use Sysinternals: Process Explorer and Right Click > Suspend the exactable that had the key locked. Suspending the app made sure that it was malleable (since it releases the locks that it had) but also doesn’t force the app to reload and possibly reset/repair the key value while you’re working on it.

In Process Explorer, you can use Ctrl+F and search using the program location, program name, or DLL to find which apps are using it. Double Click to jump back to the main ProcEx window with the program highlighted and selected for you. Suspend it and then make your changes.

Besides that, the only other thing of note is to make sure that you have the parent regkey permissions update the child regkeys. Just adding the permissions per key won’t mean you have 100% access to everything under it.

The work around for me came from here: How to disable SBS 2003 to 2008/2011 migration grace time period expiration

Leave a Reply

Your email address will not be published. Required fields are marked *