cancel
Showing results for 
Search instead for 
Did you mean: 

Search whole registry for a string of text to delete?

henderson1977
Grafter
Posts: 191
Registered: ‎31-07-2007

Search whole registry for a string of text to delete?

Hi all
I have used REG QUERY throughout batch distribution packages successfully many times. So I thought I would be able to find the answer to this request, but am struggling. Apologies if I have posted in the wrong section.
I want to use a command line to search the whole registry (HKLM, HKCU, HKU, HKCR & HKCC) of multiple XP machines for a specific string of text, e.g. "TotalSpeech 2", and delete every instance found.
This is because we think there have been more than one instance of the same MSI to install the same application and that each MSI uses a different GUID in the registry. In fact, these particular MSIs create a 'backup' of the application in the following folder to repair itself when it has been manually uninstalled but is launched from a shortcut that was copied to Startup:-
C:\Documents and Settings\%username%\Application Data\Microsoft\Installer
I have searched the web for answers but only found old commands, such as RegFind and Dureg, both not available in XP.  Perhaps a VBScript could do this, but I'm no VB guru (?)
Can anyone point me in the right direction please?
Thanks
Scott
5 REPLIES
VileReynard
All Star
Posts: 11,175
Thanks: 303
Fixes: 11
Registered: ‎01-09-2007

Re: Search whole registry for a string of text to delete?

This is probably out-dated but I know NT4 allowed you to use regedit to export everything to a .reg file.
For security rename the .reg to .txt or something,
Load it into Word, wait for it to load.
Search the word document then when you have found the aproximate location use regedit to do the job.
Horrible hack isn't it?

henderson1977
Grafter
Posts: 191
Registered: ‎31-07-2007

Re: Search whole registry for a string of text to delete?

Hi axisofevil - thanks for the prompt reply.
Although, this method will only work for one machine. 
I need a script that will search EVERY users' registry for "TotalSpeech 2" and delete every instance found.
Someone else has suggested a VBScript, but I'm no VB guru, so would need help with this.
Cheers
Scott
MikeWhitehead
Grafter
Posts: 748
Registered: ‎19-08-2007

Re: Search whole registry for a string of text to delete?

IIRC you can create a .reg file which removes specific entries, or is it still too early for me to be thinking? (Yes I know it's 11am!)
EDIT: Yep you can with a registry file. See here.
Community Veteran
Posts: 1,576
Thanks: 3
Registered: ‎13-04-2007

Re: Search whole registry for a string of text to delete?

I would assume that the key would be the same in every case or possibly 2 places so you shouldn't need to search the reg just delete 2 values.
The problem searching the reg is it would take a long time and you dont know what you have found it could be a key subkey dword etc so just deleting it could not do the job or worse.
You could try Autoit which will create an exe from a simple script from
http://www.autoitscript.com/autoit3/
Its great as it only needs 2 lines of code to do what you want and with the help file examples all you have to do is change the key.

If you want vb scripts you can get them from but the auto it is a lot better and very simple
http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/registry/#DelRegKey.htm
Community Veteran
Posts: 1,576
Thanks: 3
Registered: ‎13-04-2007

Re: Search whole registry for a string of text to delete?

Just as a example in Autoit to delete a reg entry all you need is
RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE", "TestKey")
so 1 line of code for each reg entry it just shows how simple Autoit is and its FREE