Registry Editor is a powerful tool to configure several settings on a PC. You can manipulate various keys inside it to take full control of your computing environment. Nevertheless, one needs to be utter careful while poking around registry entries, especially deleting them as it contains important configuration information for the operating system, for installed applications as well as individual settings for each user and application.
Sometimes when you want to delete a registry key which is associated to any unused program or application, you might end up getting an error which says Cannot delete : Error while deleting key. This happens primarily because of permission issues. You need to have full permissions and control over a registry key in order to delete it.
I recently got this error when I was trying to delete a nugatory registry key pertinent to an uninstalled application.
Since the registry keys may remain in System even after the uninstallation, it can possibly create problem during reinstalling the same application.
Fix Error While Deleting Key
You can fix this error by taking full ownership and permissions of the registry key you are trying to delete. Here’s how to do so:
1. Press + R to open Run prompt. Type regedit.exe and hit Enter. Select Yes in the User Account Control window that pops up, to launch Registry Editor.
2. Navigate to the registry key for which you want to take permission in the left pane. Right-click on it and select Permissions from the options listed.
3. A new window opens up to configure the permissions on the current registry key. In this window, look for Advanced button on bottom right corner and click on it.
4. Now, in Advanced Security settings window, click on Change link on the top, as shown in image below.
5. Enter your username in Enter the object name to select field and click on Check Names button. If the username is a valid one, it should pick it up otherwise it may throw an error.
6. Click on OK button to save the settings. Now, in the re-surfaced Permissions window, select your username under Group or user name field and check Allow checkbox in front of Full Control option.
7. Click on Apply and then on OK to save the settings. Bingo! You have taken full permissions of the registry key you were trying to delete and got error in the first place.
You should be able to get rid of the culprit key now.