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

WebMaximus

New member
Local time
11:48 AM
Messages
37
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 Computer My Computer

At a glance

Windows 7 Ultimate x64
Computer type
PC/Desktop
OS
Windows 7 Ultimate x64
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 Computer My Computer

At a glance

Win7 sp1 Pro 64bit / XP sp2 Pro (games only)Intel Core 2 Duo E8400 @ 3.00GHz8.00 GB Dual-Channel DDR2 @ 400MHz (5-5-5-18)1024MB GeForce GTX 560
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Home built
OS
Win7 sp1 Pro 64bit / XP sp2 Pro (games only)
CPU
Intel Core 2 Duo E8400 @ 3.00GHz
Motherboard
Intel Corporation DP35DP (CPU1)
Memory
8.00 GB Dual-Channel DDR2 @ 400MHz (5-5-5-18)
Graphics Card(s)
1024MB GeForce GTX 560
Sound Card
NVIDIA High Definition Audio
Monitor(s) Displays
SyncMaster (2048x1152@60Hz)
Hard Drives
240GB Sandisc Extreme Pro SSD
244GB Seagate ST3250410AS
488GB Seagate ST500DM002-1BD142
931GB Western Digital WDC WD1003FZEX
PSU
Corsair 720
Case
ATX
Keyboard
HID Keyboard Device Logitech
Mouse
HID-compliant mouse Microsoft
Other Info
TSSTcorp CDDVDW SH-S223L

HL-DT-ST BD-RE BH12LS35
Already tried CCLeaner but unfortunately it didn't find these keys.

Thanks for the tip regarding Revo.
 

My Computer My Computer

At a glance

Windows 7 Ultimate x64
Computer type
PC/Desktop
OS
Windows 7 Ultimate 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 Computer My Computer

At a glance

Windows 10 Pro X64Intel Quad Core i7-4770 @ 3.4Ghz16.0GB PC3-12800 DDR3 SDRAM 1600 MHzIntel Integrated HD Graphics
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Lenovo IdeaCenter 450
OS
Windows 10 Pro X64
CPU
Intel Quad Core i7-4770 @ 3.4Ghz
Memory
16.0GB PC3-12800 DDR3 SDRAM 1600 MHz
Graphics Card(s)
Intel Integrated HD Graphics
Sound Card
Realtek HD Audio
Monitor(s) Displays
HP 22" LCD
Screen Resolution
1680 x 1050
Hard Drives
250GB Samsung EVO SATA-3 SSD
2TB Seagate ST2000DM001 SATA-2
1.5TB Seagate ST3150041AS SATA
Keyboard
Dell USB
Mouse
Lenovo USB
Internet Speed
Cable via Road Runner 3MB Upload, 30MB Download
Antivirus
Windows Defender, MBAM Pro, MBAE
Browser
Seamonkey
Other Info
UEFI/GPT
PLDS DVD-RW DH16AERSH
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 Computer My Computer

At a glance

Windows 7 Ultimate x64
Computer type
PC/Desktop
OS
Windows 7 Ultimate x64
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.
 

Attachments

My Computer My Computer

At a glance

Windows 10, Windows 8.1 Pro, Windows 7 Profes...
Computer type
PC/Desktop
OS
Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
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 Computer My Computer

At a glance

Windows 7 Ultimate x64
Computer type
PC/Desktop
OS
Windows 7 Ultimate x64
Back
Top