Dismiss Notice
You are browsing this site as a guest. It takes 2 minutes to CREATE AN ACCOUNT and less than 1 minute to LOGIN

Run Regedit as SYSTEM to Solve Error While Deleting Key

Discussion in 'Tech, Gadgets & Science Forum' started by MziziMkavu, Aug 23, 2011.

  1. MziziMkavu

    MziziMkavu JF-Expert Member

    #1
    Aug 23, 2011
    Joined: Feb 3, 2009
    Messages: 38,560
    Likes Received: 2,844
    Trophy Points: 280
    Run Regedit as SYSTEM to Solve Error While Deleting Key Author: Raymond



    Yesterday one of our forum member solin asked a question on how to delete the LEGACY section at registry. After uninstalling antivirus such as AVG, Avast, G Data and etc, it leaves some registry keys at HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\Root\LEGACY_* and also at ControlSet002. I can confirm this because I installed the Free AVG 2011 and after uninstalling it, I found a few LEGACY_AVG* keys at both ControlSet001 and ControlSet002. When trying to delete the LEGACY keys, Windows 7 prompts the error “Error Deleting Key” with the message “Cannot delete LEGACY_AVGIDSDRIVER: Error while deleting key“. You would also see this error even if you are an Administrator of the local computer with UAC disabled.
    [​IMG]
    Although it shouldn’t cause any problems to Windows since the ControlSetXXX are backups, but some users would prefer to keep their computer as clean as possible. Registry is a database and logically if a database gets too big with a lot of junk, the system eventually becomes slower. Microsoft Knowledge Base (KB) explains the following:
    “ControlSet001 may be the last control set you booted with, while ControlSet002 could be what is known as the last known good control set, or the control set that last successfully booted Windows NT. The CurrentControlSet subkey is really a pointer to one of the ControlSetXXX keys.”


    If you still want to go ahead and remove the LEGACY entries, you can either take ownership of the registry key and setting the full control permission or simply run the Registry Editor (regedit) as SYSTEM.

    1. Download RunAsSystem, extract and run it.
    2. Click the Browse button and look for regedit.exe which is normally located in Windows folder.
    [​IMG]
    3. Click Open and followed by OK which will open the Registry Editor.
    4. As you can see from the screenshot below, regedit.exe is now running under SYSTEM account. You can delete the LEGACY entries without the “Error While Deleting Key” message.
    [​IMG]
    You should make a backup of the registry keys that you want to delete by right clicking and select Export. Do note that when you want to restore it back, you cannot run the .reg file directly as you would get the error “Cannot import file.reg: Error accessing the registry”. The solution is to either run the regedit as SYSTEM, and import it from File > Import, or run the .reg file using RunAsSystem
     
Loading...