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.

  • What key are you trying to edit? – OSol1tair3 May 1 '15 at 22:59
  • Third party filtering software. – Krii May 1 '15 at 23:00
  • This on a domain by chance? – Ramhound May 2 '15 at 0:30
  • My computer was on a domain, but not anymore. – Krii May 2 '15 at 0:45

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.

Edit: 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

up vote 3 down vote accepted

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).

Directions:

  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:\Windows\System32\drivers and delete the driver you want.

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

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

  • Unfortunately, this doesn't seem to work. – Krii May 2 '15 at 0:46

You could run Safe Mode and there open the regedit and try to delete the keys. If the keys were created by the program that was uninstalled, then try to recover to the point before uninstalling (better - before installing). After that use the methode mentioned above.

  • The driver was in the System32\drivers folder. So the driver would automatically start on Safe Boot. – Krii Oct 27 '15 at 21:08

psexec -i -d -s c:\windows\regedit.exe

get file from here & unzip in path and run command above

https://docs.microsoft.com/en-us/sysinternals/downloads/psexec

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.