/build/static/layout/Breadcrumb_cap_w.png

How can I use VBScript to enumerate HKEY_CLASSES_ROOT\Installer\Products and delete a key and all subkeys only if specific REG_SZ data exists within it?

Hi everyone,

 

I've run into a bit of a problem, something happens with installations of Adobe Flash on the workstations in my environment, and it's causing them to give an error when you try to uninstall it.  We are pushing Adobe Flash out via the .msi's with group policy(software installation policy), and the problem comes in when technicians are constantly having to visit workstations to search for a particular registry key, delete it manually, and then Adobe Flash will install on the next reboot.  Let me explain a bit more,

 

To fix this error on an affected workstation you have to search under "HKEY_CLASSES_ROOT\Installer\Products", and under one of the subkeys here, such as "30AC997E64E77EA47A6B9E40CCDF5192", you will find one with a REG_SZ value of "ProductName", it's data is "Adobe Flash Player 11 ActiveX".  The problem is we have to search each one of these lengthly subkeys for the one that belongs to the Adobe Flash installation.  Once we find it and remove the entire "30AC997E64E77EA47A6B9E40CCDF5192" that has the REG_SZ value of "ProductName" data "Adobe Flash Player 11 ActiveX", we can reboot the workstations, and things work great. 

 

The problem I'm really having is on every workstation the "30AC997E64E77EA47A6B9E40CCDF5192" used here is only an example, this string is random from machine-to-machine, it's generated during the Adobe Flash installation.  This is where I'm stuck having to make the script search and evaluate everything under HKEY_CURRENT_USER\Installer\Products.

 

What can I do fellas, is it even possible?

 

Here's a screenshot for a little more clarity:

http://i.imgur.com/aAqYl.jpg


0 Comments   [ + ] Show comments

Answers (5)

Answer Summary:
Thanks for the input everyone, here is the working code for future reference! @echo off set product=Adobe Flash Player 11 ActiveX for /F "delims=" %%a in ('reg query HKEY_CLASSES_ROOT\Installer\Products') do call :Sub %%a goto :eof :Sub set key= reg query "%*" | find /i "%product%" && set key=%* if "%key%"=="" goto :eof reg query "%*" | find /i "%product%" echo Y|reg delete "%key%"
Posted by: LogicBomb 11 years ago
Senior Yellow Belt
3

Thanks for the input everyone, here is the working code for future reference!

@echo off
set product=Adobe Flash Player 11 ActiveX
for /F "delims=" %%a in ('reg query HKEY_CLASSES_ROOT\Installer\Products') do call :Sub %%a
goto :eof

:Sub
set key=
reg query "%*" | find /i "%product%" && set key=%*
if "%key%"=="" goto :eof

reg query "%*" | find /i "%product%"
echo Y|reg delete "%key%"

Posted by: andemats 11 years ago
2nd Degree Black Belt
2

This should get you started.

http://us.generation-nt.com/answer/script-search-delete-registry-keys-help-30470632.html

Note that HKCR = &H80000000


Comments:
Posted by: piyushnasa 11 years ago
Red Belt
1

Use the uninstaller from Adobe for Flash player:

http://helpx.adobe.com/flash-player/kb/uninstall-flash-player-windows.html


Comments:
  • Ah that would ofc work too.

    Note to self: *Need to think outside of the box* ;-) - andemats 11 years ago
  • Thanks, I tried this, even if fails during removal... appreciate your assistance. - LogicBomb 11 years ago
Posted by: LogicBomb 11 years ago
Senior Yellow Belt
1

Here's what I have so far, it's a batch file and someone from microsoft technet helped put it together.  It does the job great, but it doesn't remove the key, only reports it via output.txt. 

 

Can anyone help with where I might put the "reg delete" syntax in all of this?

 

 

@echo off
set product=Adobe Flash Player 11 ActiveX

if exist output.txt del output.txt
for /F %%a in ('reg query HKEY_CLASSES_ROOT\Installer\Products') do call :Sub %%a
notepad output.txt
goto :eof

:Sub
reg query %1 | find /i "%product%" >> output.txt && echo %* >> output.txt


Comments:
  • looks like you have an answer from another site
    http://social.technet.microsoft.com/Forums/en/ITCG/thread/e8d652a4-1047-4065-9f8e-45c5943e4a80 - SMal.tmcc 11 years ago
Posted by: SMal.tmcc 11 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ