5 Ways to Solve Error While Deleting Key Problem When Editing Restricted Registry

Most advanced users know all about it, but if you didn’t know what the Windows registry is, it’s a several megabyte database that stores most of the information for your Windows operating system. It contains thousands of configuration settings for Windows itself, third party software, hardware and preferences for the individual users on the computer. Editing the Windows registry can be dangerous if you don’t know what you’re doing because if you wrongly delete an important key, Windows might not be able to boot up the next time.

So no matter how confident and experienced you are, it’s always a sensible idea to be a little bit safer and make a backup of the registry keys that you intend to edit, or even better, make a complete backup of the whole registry as well just in case. If you’re trying to edit or delete keys from the registry to repair or recover from certain problems, you might find that some keys won’t let you do anything with them and you’ll get an error such as “Cannot delete xxxxx: Error while deleting key”. These keys are usually protected to stop accidental deletion and it’s important you have the correct key before trying to change it.

Error While Deleting Key

You could also be the administrator on the computer, but still can’t manipulate the required key, which might sound quite odd. Even though the administrator account has a great deal of control, there are other hidden accounts and levels on the system which have even greater access and therefore standard administrator privileges are not enough. To solve this problem, you have to force the registry to allow the logged on user full control of the subkeys. Below are several different ways of performing this operation to give you the required access. 1. Run Regedit using the RunAsSystem tool

As well as being able to take ownership of registry keys and setting the permissions manually, another thing you can do is run the Windows registry editor with highly elevated privileges. This can be achieved with the System account that is even more powerful than the administrator and therefore has more access to protected registry keys. This has the added bonus of allowing you to view the SAM and SECURITY registry keys which are otherwise hidden. A small portable tool called RunAsSystem is able to do this for any program you tell it to, here’s how.

1. Download RunAsSystem, extract and run it.

2. Click the Browse button and look for regedit.exe which is normally located in the Windows folder, or simply type regedit into the box.

RunAsSystem

3. Click OK which will open the Registry Editor. If you open up the Task Manager, and as you can see from the screenshot below, regedit.exe is now running under the SYSTEM account where it would normally run under the user’s standard account. You can delete several legacy keys without the “Error While Deleting Key” message.

Regedit as System

RunAsSystem is also useful if you want to restore any registry keys that were deleted this way because importing the keys would produce a “Cannot import file.reg: Error accessing the registry” message from the standard admin/user account. The solution is to either run regedit as System, and import it from File -> Import, or run the .reg file using RunAsSystem.


2. Use the PsExec tool

The PsExec command line utility is part of the PSTools remote administration set of command line utilities from Sysinternals. Like the RunAsSystem tool, PsExec also allows you to see the SAM and SECURITY keys that are hidden under normal circumstances. It works in a similar way too by elevating the registry editor to run under the System account granting more control over the registry. You need to make sure you have administrator privileges in the first place for this to work.

1. Download and extract the PSTools.zip file from the Sysinternals website. Right click on the PsExec utility and click Create Shortcut (or Send to -> Desktop).

2. Right click on the shortcut -> Properties and add the following to the end of the line in the Target box:

{space}-i -d -s c:\windows\regedit.exe

regedit with psexec

3. Click OK and then double click the shortcut to launch Regedit under the System account. If you’re still unable to delete or edit the keys you want, try the next solution below.


3. Registrar Registry Manager

Registrar is a registry editing tool with several advanced features and is a lot more like a standard Windows Explorer interface with toolbar buttons for back, forward, cut, copy, paste etc. It also has advanced searching and comparing functions, bookmarking, a registry defragmenter and a backup and restore option. There are other features such as multi level undo and remote registry editing, but they along with several other features are only available in the Professional version which costs around $55.

Thankfully there is a free Home Edition that allows you to browse and edit the registry without any problems, the only downsides are the nag screen and not knowing some functions aren’t in the free version until you click on them. Like the tools above it also shows the usually hidden SAM and SECURITY keys, and while testing it was able to edit or delete a number of the registry keys that the tools above couldn’t. Keys you would normally have to edit the permissions manually to delete such as those that need removing to repair the Features window problem in Windows Vista or 7 are done so with the click of a button.

Registrar Registry Manager

Usage is pretty much the same as regedit and you simply navigate your way to the required key and then right click on it or use the buttons in the toolbar to rename or delete etc. If manually editing registry permissions sounds to confusing, this might be your best option. Registrar can also be made portable by copying its folder from Program Files, and works on Windows XP up to Windows 8.

Download Registrar Registry Manager Home

If even these tools aren’t working for you, the next option will be to edit the permissions for the key manually using Regedit or simply use a low-level anti-rootkit tool. On page 2 we’ll show you how.

4. Manually Edit Registry permissions

First of all, you need to make sure that your account has administrative privileges to be able to edit the registry. And secondly, to edit the restricted registry you need to know what the currently logged on user’s name is. You should know this but if you’re not exactly sure of the current user name, a simple way of telling is clicking on Start and looking at the top (XP) or top right (Vista/7) of the Start menu. Alternatively find out from the Windows Task Manager. Simultaneously press Ctrl+Shift+Escape, go to the Processes tab and check the User Name column. You should see SYSTEM, LOCAL SERVICE, NETWORK SERVICE and the logged on User name.

Check Currently Logged On User Name

Now simply follow the steps below to take full control of a restricted registry key. There are thousands of protected keys in the registry with varying levels of restrictions, do not that not all keys can be deleted even using this method.

1. Run the Registry Editor by typing regedit in the Run box (Win key+R) or from the Start search box.

2. Navigate to the registry key you want to take full control of, right click on it and select Permissions. Then click the Advanced button.

Setting Registry Permissions

3. Go to the Owner tab, select the user name that the system is logged on with and tick “Replace owner on subcontainers and objects” and click OK.

Taking Registry Ownership

4. Now you should be back at the Permissions window again. In Windows XP, click on Everyone and then tick Full Control for Allow. In Windows Vista and Windows 7/8, select the group which the currently logged on user belongs to (Administrators) and tick Full Control for Allow. Click OK.

Full Control Registry Permissions

Now you can modify and delete the protected registry keys. Windows protects those registry keys from being easily modified for a safety reason, so make sure you know what you’re doing before messing with it.


Depending on which keys you’re trying to edit, the above steps still might not be enough and you’ll get “Error while deleting key” again with the Allow tick boxes grayed out. If that’s the case, follow these extra steps:

1. Click on Advanced again and in the window highlight the same user group from step #4 above.

2. Tick the “Replace all child object permissions with inheritable permissions from this object” box and untick “Include inheritable permissions from this object’s parent”. Click Add (or Copy for XP) in the warning popup and then OK. The grayed out Allow tick boxes should now be enabled and already ticked, now try to edit the key.

inherit extra permissions

Unfortunately there are still certain keys in the registry which cannot be edited because they are in use and locked by the system. No amount of permissions tweaking will allow them to be touched. In that scenario the only other option may be to edit the registry while it is offline.


5. Using low-level anti-rootkit tools

Anti-rootkit tools are very powerful low-level utilities that is capable in detecting and removing rootkits. There are 2 of such anti-rootkit tools that comes with a registry editor which looks very similar to the Windows regedit except it bypasses the Windows restrictions to allow full control in deleting and editing restricted registry keys.

AntiSpy Delete Restricted registry

All you need to do is run either AntiSpy or PC Hunter, go to the Registry tab, navigate to the key that you cannot delete from the Windows regedit, right click and select Delete. The deleted keys takes effect instantly without requiring a restart.

Download AntiSpy | PC Hunter

88 Comments - Write a Comment

  1. name 5 days ago
  2. Jean 1 week ago
  3. iKeddz 3 weeks ago
  4. chiudo 2 months ago
  5. Robbie 2 months ago
  6. Yerbol 2 months ago
  7. Deepak Verma 3 months ago
  8. MoltresRider 6 months ago
    • HAL9000 6 months ago
  9. Another nice one 7 months ago
  10. VINCY 8 months ago
  11. shahrooz 8 months ago
  12. Jon 1 year ago
  13. Highlander 1 year ago
  14. A 2 years ago
  15. Hakim 2 years ago
  16. Carlos 2 years ago
  17. Damien 2 years ago
  18. Vedaprakash 2 years ago
  19. Minami 2 years ago
  20. william campbell 2 years ago
  21. Anthony 2 years ago
  22. Matthew 2 years ago
  23. Yubaraj 2 years ago
  24. Marek 3 years ago
  25. Mr.Afridi 3 years ago
  26. Pete 3 years ago
  27. Scott 3 years ago
  28. Galahad 3 years ago
  29. Masonic_Knight_Templar 3 years ago
  30. Thanks 3 years ago
  31. Raja (India) 3 years ago
  32. Bruce 3 years ago
  33. saz@gmail.com 3 years ago
  34. Mayura 3 years ago
  35. Anon 3 years ago
  36. Tom 3 years ago
  37. Sammy 3 years ago
  38. RunAsTheMAN 3 years ago
  39. lemon 3 years ago
  40. cad 3 years ago
  41. Joan 3 years ago
  42. Nico 4 years ago
  43. Fakhri Aunurrahim 4 years ago
  44. rajiv 4 years ago
  45. Aditya 4 years ago
  46. Taaniel 4 years ago
  47. J M Ward 4 years ago
  48. Nestor 4 years ago
  49. Jawher Bel Mabrouk 4 years ago
  50. Joe Isaac 4 years ago
  51. amer 4 years ago
  52. prasenjit 5 years ago
  53. Henk Boonstra 5 years ago
  54. Pierre Lariviere 5 years ago
  55. godslave 5 years ago
  56. Pradeep KR 5 years ago
  57. Dan 5 years ago
  58. Roberto 5 years ago
  59. Ali Asadullah 5 years ago
  60. Dc 5 years ago
  61. Gus 5 years ago
  62. Denyzor 6 years ago
  63. Someone 6 years ago
  64. James Frimpong 6 years ago
  65. kalyan 6 years ago
  66. Merlin_Magii 6 years ago
  67. Johan 6 years ago
  68. Shaer Alvy 6 years ago
  69. PRB238 7 years ago
  70. Pie 7 years ago
  71. Mikkel 7 years ago
  72. Vijay 7 years ago
  73. Greg 8 years ago
  74. kash 8 years ago
  75. Dazza 8 years ago
  76. David Bradley 9 years ago
  77. ahashmi06 9 years ago
  78. Heath 9 years ago
  79. Azfar 9 years ago
  80. Merlin_Magii 9 years ago
  81. ferdi 9 years ago
  82. braco 9 years ago
  83. Jeff 9 years ago
  84. Roy Raay 9 years ago
  85. mamed 9 years ago
  86. Rekhyt 9 years ago
  87. mazani 9 years ago

Leave a Reply

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

Note: Your comment is subject to approval. Read our Terms of Use. If you are seeking additional information on this article, please ask in our forum or contact us directly.