Windows 7 Unable to remove any registry key in the HKEY_LOCAL_MACHINE hive

hasek747

New Member
Hi guys,

I cannot, for the life of me, delete any key in the HKLM hive. Things I've tried:
  1. Logging in as administrator
  2. Running an elevated regedit
  3. Setting Full Permissions to edit the key
  4. Taking ownership of the key
  5. Doing all of the above in regedt32
  6. Running in safe mode
  7. Malwarebyte's Reg Assassin
  8. Reinstalling Windows (I didn't reinstall for this purpose, I had a different reason for doing so, but the reinstall didn't change anything.)
I'm running Windows 7 Ultimate. Any help? I'm getting frustrated :)
 
What happens when you try and fail? Any error messages, prompts or anything.
Have you tried with the plain vanilla regedit rather than regedt32? Are the results the same?
 
Hi, thanks for trying to help!

Yes, I do get an error, it reads:

"Cannot delete [key name]: Error while deleting key.

And to answer your other question; I have done everything in both regedt32 and plain old regedit - the results were the same.

Any ideas?
 
From your original post you seemed to indicate that it was a wide spread problem
"I cannot, for the life of me, delete any key in the HKLM hive"
but I really can't imagine anyone just willy nilly attempting to delete random keys especially in that HIVE. So is it a particular key or two or a particular data value that you are trying to delete? The reason I ask is because of problems with embedded Null characters in some keys, take a look at this article and see if you think the tool there might do the trick
Unable to delete certain registry keys - Error while deleting key
 
From your original post you seemed to indicate that it was a wide spread problem but I really can't imagine anyone just willy nilly attempting to delete random keys especially in that HIVE. So is it a particular key or two or a particular data value that you are trying to delete? The reason I ask is because of problems with embedded Null characters in some keys, take a look at this article and see if you think the tool there might do the trick
Unable to delete certain registry keys - Error while deleting key

Hi again,

I am trying to delete keys in USBStor and similar - need to remove traces of certain USB devices being connected to my machine in the past.

The reason I said it was a widespread problem is because I have no trouble deleting keys from other hives (I do that often,) so I backed up HKLM and tried deleting some other random keys and couldn't get it to work.

I'll take a look at the article, thanks a lot!
 
Running out of ideas here.
I know you've said that you've done this already but just try adding the everyone group full permission to the key and make sure that you cascade it down to all sub containers
Open regedit
Right click the key and choose "Permissions"
In the Group or user names: frame click the add button, then advanced, then find now, scroll as needed and select Everyone then OK twice, then make sure that everyone is selected in the top frame and check the Full Control check box and then click the "Advanced" button, uncheck "Include inheritable permissions from this object's parent" (this will break inheritance so make sure you really want this to happen) All you want left is the Everyone Group = Full Control and then check the box that says "Replace all child object permissions with inheritable permissions from this object" OK your way back out of there and see if that helps anything at all with your problem. My main concern is that you may have conflicting group memberships for the username that you are using, you may be part of the administrators group with full control and then also be part of the users group with read only permission, so you are going to end up with read only rights and unable to delete. At least that's what I'm thinking and of course the Registry Editor disclaimer:
Using the Windows Registry Editor can cause serious, system-wide problems that may require you to re-install Windows to correct them. It cannot be guaranteed that any problems resulting from the use of the Windows Registry Editor can be solved. If you choose to edit the Windows Registry you do so at your own risk so unless you feel fairly comfortable and confident you should probably not use the Editor. Changes made to the Windows Registry can take effect immediately and those that do not will take effect following the next reboot of your computer, and a current backup is not automatically made for you....So manually create a system restore point, backup the registry and export the key you are editing for safe keeping before doing so.
 
Thanks for your time Trouble.

Actually, something weird just happened. When I check the Replace all child object permissions with inheritable permissions from this object box and hit OK, I get the following error:

Registry Editor could not set security in the key currently selected, or some of its subkeys.

What do you make of this?

Getting the exact same error for the administrator account as well.
 
Last edited:
Thanks for your time Trouble.

Actually, something weird just happened. When I check the Replace all child object permissions with inheritable permissions from this object box and hit OK, I get the following error:

Registry Editor could not set security in the key currently selected, or some of its subkeys.

What do you make of this?

Getting the exact same error for the administrator account as well.
Not exactly sure, perhaps your earlier efforts to take ownership of one of the parent keys was not successfully cascaded down to subs.
You may have to trouble shoot this by drilling down to subkey containers and ascertaining their individual properties pertaining to ownership and permissions.
Seems to me that there should be an easier way of doing this have you taken a look for utilities like Nirsoft's USBDeView, seems in the past that I have used this or a similar utility to remove references to old, unused USB devices. But I'm not sure that any such utility will remove all registry keys related to the device or not.
 
Yes, I've used USBDeView and tried to take advantage of it somehow; unfortunately it doesn't do what I require (registry entries remain.) I have done this kind of cleaning many times in Windows XP without any trouble, it's only in Windows 7 that it seems to be an issue (not sure if it's just me or all Win 7 installations.) I've done a search in RegSeeker and seems all of my target keys are located in HKLM... :)Thanks for your help, I'll keep digging.
 
OK, well keep us posted, I for one would be interested in hearing how you make out.
As a semi-interesting aside and for future reference
C:\Windows\System32\regedt32.exe really doesn't do anything anymore except call
C:\Windows\regedit.exe
In Windows XP and later, Regedit.exe is the only Registry Editor tool that is included in the operating system. Regedt32.exe is no longer a part of Windows XP or Windows Server 2003. A primary use of Regedt32.exe that was missing from earlier versions of Regedit.exe , was to set permissions and other security settings for registry keys and subkeys. That feature is now available in the version of Regedit.exe that is included in Windows XP and Windows Server 2003.
Note: If you try to start the Regedt32.exe tool in the Run dialog box of Windows XP or Windows Server 2003, Regedit.exe starts, and Windows does not generate an error message.
SOURCE: How to set or change registry editing permissions in Windows XP or in Windows Server 2003

Regards
Randy
 
Good to know, thanks a lot.To be honest I have no idea where to look for solutions anymore, I'd love to just nuke these keys somehow :)I'll let you know if I find a solution.
 
As an alternative, how about using this Microsoft site to set Device Manager to show all devices, even ones that have been removed, and possibly delete them this way.

If that doesn't work, have you tried exporting the portion of the registry you want to change, change it, then import the new version.
 
Back
Top