VBScript Question

kzrssk

Member
Nov 13, 2005
111
0
0
Hi all,

I'm trying to write a VBScript that will run through HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall searching for any key whose DisplayName value contains a certain string. If it matches, I would need it to go into that key, read the UninstallString and run it.

I tried enumerating the keys in HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall into some sort of collection then delving into each key with For...Next loops looking for UninstallString's, but for some reason it really didn't work out.

Could someone tell me if I'm going about it all wrong or help me out with a bit of code?

Thanks,

Chris
 

gsellis

Diamond Member
Dec 4, 2003
6,061
0
0
Not ignoring you. Just don't remember doing this with wscript.regread. I think you can use REG.EXE to open the hive and parse the tree. Look at REG /? for help and web search it.
 

gsellis

Diamond Member
Dec 4, 2003
6,061
0
0
More... Ok, did this this morning

reg query HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall /s >c:\parse.txt

The results look like this (abridged - lines will wrap differently as pasted)

[/quote]
! REG.EXE VERSION 3.0

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\AddressBook
<NO NAME> REG_SZ

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\Branding
QuietUninstallString REG_SZ Rundll32 IedkCS32.dll,BrandCleanInstallStubs
RequiresIESysFile REG_SZ 100.0

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\Connection Manager
SystemComponent REG_DWORD 0x1

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\DECCHECK
UninstallString REG_SZ RunDll32 advpack.dll,LaunchINFSection C:\WINDOWS\INF\DECCHECK.inf,Uninstall
DisplayName REG_SZ Microsoft Windows XP Video Decoder Checkup Utility
[/quote]

So, you can create a temp file, pipe the results to it (the wshshell.run is like the string I ran above), then open the temp file and parse it.