Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Any way to automate deleting lots of keys from the registry?

14 Mar 2015   #1
WebMaximus

Windows 7 Ultimate x64
 
 
Any way to automate deleting lots of keys from the registry?

Does anyone know if there's some freeware tool that would allow me to delete lots of keys from the registry under a specific hive containing a string value which in turn contains a specific value?

Below is a short extract from my registry where I exported the hive of interest and as you can see some of the keys contain a string containing the value 'Microsoft Flight simulator X'

Code:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\DB458B8A779B8B9D6853499E99DC17B6]
"5F30FE2770501684A9449DF94D4C4181"="C:\\Program Files\\Paint.NET\\Resources\\it\\Files.AboutCredits.rtf"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\DB4C64BA715DB0E45A96CE93457A0ABF]
"3BB6B5B440AD65B4EA71DDFBF3448688"=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\DB5A057B2C8023D4C88B5811F98BC4C5]
"9040580900063D11C8EF10054038389C"="C:\\Program Files (x86)\\Microsoft Office\\OFFICE11\\UCSCRIBE.DLL"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\DB5A057B2C8023D4C88B5811F98BC4C5\9040580900063D11C8EF10054038389C]
"PatchGUID"="{5798D425-7593-4FE5-BE53-E60DEBB65A53}"
"MediaCabinet"="PCW_CAB_H15000_1"
"File"="UCSCRIBE.DLL_0002"
"ComponentVersion"="11.0.8161.0"
"ProductVersion"="11.0.6506"
"PatchSize"="0"
"PatchAttributes"="0"
"PatchSequence"="10010"
"SharedComponent"="0"
"IsFullFile"="1"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\DB61AF379CDB76047BD6318B9D421FCF]
"694A72599FD5A214DA7C61B85A73C96A"="F:\\Program Files (x86)\\Microsoft Games\\Microsoft Flight Simulator X\\SimObjects\\Airplanes\\Grumman_Goose_G21A\\Texture.1\\Fresnel_Ramp.dds"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\DB6BCDDA824074D448EC6F57C30142DA]
"694A72599FD5A214DA7C61B85A73C96A"="F:\\Program Files (x86)\\Microsoft Games\\Microsoft Flight Simulator X\\SimObjects\\GroundVehicles\\VEH_Air_FireTruck_Euro_sm\\sim.cfg"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\DB6E9B4033F985670CF18C3B9B1A1EE8]
"c1c4f01781cc94c4c8fb1542c0981a2a"=""
"1D7AD0FA68A03E11788E0FD42AA3C585"=""
"b25099274a207264182f8181add555d0"=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\DB6FEC9342BC5F9439DC375AAE2D7702]
"694A72599FD5A214DA7C61B85A73C96A"="F:\\Program Files (x86)\\Microsoft Games\\Microsoft Flight Simulator X\\SimObjects\\Airplanes\\Bombardier_CRJ_700\\panel\\Bombardier_CRJ_700.cab"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\DB7673335BBD6FF489B241C29C3977FC]
"D3C479BC101D1144F845CDCD85ED8D51"="C:\\Program Files\\Protector Suite\\Interop.WMPLib.dll"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\DB7949BC483A8973F71343A37A9FC425]
"5F30FE2770501684A9449DF94D4C4181"="C:\\Program Files\\Paint.NET\\Resources\\en-US\\Icons.InvertColorsEffect.png"
So...what I would like looking at the example above is to find a tool where I could simply tell it to go through the complete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components hive and delete any keys containing a string value containing Microsoft Flight Simulator X.

Of course I could do this clean-up myself manually but it will take some time considering the number of entries to remove so if there's a tool of some kind that could do this for me I would be more than happy.

Thanks in advance for any tips!


My System SpecsSystem Spec
.
14 Mar 2015   #2
Wandering one

Win7 sp1 Pro 64bit / XP sp2 Pro (games only)
 
 

More than likely C Cleaner will do if the program is uninstalled. Next time Revo uninstaller is better for uninstalling as it also checks for registry left overs. Don't neglect to select reg backup before it is too late.
Art.
My System SpecsSystem Spec
14 Mar 2015   #3
WebMaximus

Windows 7 Ultimate x64
 
 

Already tried CCLeaner but unfortunately it didn't find these keys.

Thanks for the tip regarding Revo.
My System SpecsSystem Spec
.

14 Mar 2015   #4
Ztruker

Windows 10 Pro X64
 
 

Give RegSeeker a try. You can search specific chains, like HKEY_LOCAL_MACHINE for spoecific text. When done, simply select all then right click and delete. It will also backup the entries before deleting them.
My System SpecsSystem Spec
14 Mar 2015   #5
WebMaximus

Windows 7 Ultimate x64
 
 

Quote   Quote: Originally Posted by Ztruker View Post
Give RegSeeker a try. You can search specific chains, like HKEY_LOCAL_MACHINE for spoecific text. When done, simply select all then right click and delete. It will also backup the entries before deleting them.
Many thanks, will give it a try!
My System SpecsSystem Spec
14 Mar 2015   #6
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Hi WebMaximus,

Attached is a batch script solution you can try. Running the script will display the keys that will be deleted after matching the given string. Change the "WhatIf" value, in the batch file, to FALSE to instead delete found keys.

Note: Modifying the HKLM hive requires Administrator rights, so the batch file must be run from an Elevated Command Prompt.

Please backup your registry first.


Preview:
Code:
@echo off
net session >NUL 2>&1|| echo Error: deleting from the HKLM hive requires Administrator privilages.&& timeout 2 >NUL && exit /b 1 

REM Iterate through %starting_key% and delete any child keys
REM that contain the string %string_to_find% in any value of
REM the key.

::
set starting_key="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components"
set string_to_find="Microsoft Flight simulator X"
set should_recurse=FALSE
set prompt_before_deletion=TRUE
set WhatIf=TRUE
::

set echo=& if /i not "%WHATIF%"=="FALSE" set "echo=ECHO"
set should_recurse=& if /i "%SHOULD_RECURSE%"=="TRUE" set "recurse=/s"
set prompt_before_deletion=/f& if /i "%PROMPT_BEFORE_DELETION%"=="TRUE" set "prompt_before_deletion="
echo This may take a moment...& echo.
for /f "delims=" %%A in (' reg query "%STARTING_KEY:"=%" %RECURSE% ') do (
	for /f "delims=" %%B in (' reg query "%%~A" /v "*" ') do (
		echo "%%~B"| find /i "%STRING_TO_FIND:"=%" >NUL && (
			if defined ECHO (
				echo "%%~A"& echo.
			) else (
				reg delete "%%~A" %PROMPT_BEFORE_DELETION%& echo.
			)
		)
	)
)
echo Done.


Attached Files
File Type: bat th-364156.bat (1.1 KB, 2 views)
My System SpecsSystem Spec
16 Mar 2015   #7
WebMaximus

Windows 7 Ultimate x64
 
 

Just wanted to say thanks to all of you guys for your help and valuable input!

I ended up using a combination of manual cleaning up with help from RegSeeker. RegSeeker to easy find and delete the entries in my example above and manual clean-up of some additional entries. Could have used RegSeeker for those as well but in some cases I found it more easy to manually search the registry using regedit to identify keys and values I wanted to get rid of.
My System SpecsSystem Spec
Reply

 Any way to automate deleting lots of keys from the registry?




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Lots of dead EXE files listed in registry
I have just uninstalled two programs "MediaInfo" and "MediaTab" with RevoUninstaller... (on a test rig) - rebooted the PC For interest sake I searched the registry for MediaTab and found the download path to MediaTab in .. ...
Software
AuditPol.exe - Where are the registry keys?
Hey everyone, This may be a dumb question but when we set up the Advanced Auditing features on our Win 7 image, where are the registry keys for those settings stored? I already looked at /HKLM/Security/Policy/PolAdtEv however I have nothing under Security at all (not expandable). I can confirm...
System Security
How do I know what is the function of some keys in registry?
uhh That is a good Thread tittle :p well yeah, i mean when im in regedit, i want to know what some keys are for... but still it is just a big damn tree, im wondering how some people make tutorials of, how to change an option in desktop!, how did they know that if you modify certain keys you...
Customization
Deleting registry keys with a batch file?
I downloaded a beta version of a program and it for some reason it has a "usage count" in the registry which denies access to the program after 10 uses. When i delete the key it works again but it's pretty annoying to keep deleting it through the registry all the time. I want to make a batch...
General Discussion
Need Help Deleting Legacy Registry keys W7 64 bit
I'm trying to delete some Legacy Registry Keys on W7 64 bit, and when i right click on the key to change the permissions to allow full control I receive a windows security prompt "unable to save permission Changes on Legacy.." Is there a work around for this. I may just be obsessive compulsive...
General Discussion
Major problems deleting registry keys...
I have a USB key that I need to delete. I have properly set the owner and permissions for full access. No matter what I do it does not work. It tells me error deleting key. And to add insult to injury, every time after I try deleting a subkey, windows adds a subfolder under that key's folder!!!...
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 09:02.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App