For Programmers: Free Programming Magazines  


Home > Archive > VBScript > September 2004 > Searching the Uninstall with RegRead









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Searching the Uninstall with RegRead
Anthony

2004-09-25, 3:55 pm

Is it possible to get all the keys in
hklm\software\microsft\windows\currentve
rsion\uninstall\ (the add and
remove programs list) put them into and array and then search the array
for DisplayName key for an application?

I am trying to determine if a product is installed, like Office XP.

TIA.
y sakuda

2004-09-25, 3:55 pm

"Anthony" <nomorespam@msn.com> wrote in message news:%23dye3ByoEHA.3724@TK2MSFTNGP10.phx.gbl...
> Is it possible to get all the keys in
> hklm\software\microsft\windows\currentve
rsion\uninstall\ (the add and
> remove programs list) put them into and array and then search the array
> for DisplayName key for an application?
>

Something like this?
If your OS is'nt XP or Win2000Pro,I suppose you can't enumerate subkeys.
Note: Some application don't have DisplayName
Y Sakuda from JPN

Const HKLM = &H80000002
Dim oReg, SubKey, arrSubKeys, strKeyPath, wDisp
Dim wKeyAry(), wDispAry(), I
Set oReg = GetObject("winmgmts:root\default:StdRegProv")
strKeyPath = " SOFTWARE\Microsoft\Windows\CurrentVersio
n\Uninstall"
oReg.EnumKey HKLM, strKeyPath, arrSubKeys
I = 0
For Each SubKey In arrSubKeys
ReDim Preserve wKeyAry(I)
ReDim Preserve wDispAry(I)
wKeyAry(I) = SubKey
oReg.GetStringValue HKLM, strKeyPath & "\" & SubKey, "DisplayName", wDisp
wDispAry(I) = wDisp
wscript.Echo "KeyName=" & wKeyAry(I) & ", DisplayName=" & wDispAry(I)
I = I + 1
Next
Torgeir Bakken \(MVP\)

2004-09-26, 3:55 pm

Anthony wrote:

> Is it possible to get all the keys in
> hklm\software\microsft\windows\currentve
rsion\uninstall\ (the
> add and remove programs list) put them into and array and then
> search the array for DisplayName key for an application?
>
> I am trying to determine if a product is installed, like Office XP.
>
> TIA.

Hi

E.g. take a look at the InstalledApplications procedure here:
http://groups.google.com/groups?sel...056%40hydro.com


An alternative way of detecting Office version installed
http://groups.google.com/groups?hl=...FTNGP09.phx.gbl

WMI version:
http://groups.google.com/groups?sel...53D%40hydro.com

Find what Office apps are installed:
http://groups.google.com/groups?sel...FTNGP11.phx.gbl



--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/sc...er/default.mspx
Steven Burn

2004-09-26, 3:55 pm

Thats not a very reliable way of doing it.......

You'd be much better off attempting to locate the programs folder, and doing
a fileexists on it's executable.

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!


"Anthony" <nomorespam@msn.com> wrote in message
news:#dye3ByoEHA.3724@TK2MSFTNGP10.phx.gbl...
> Is it possible to get all the keys in
> hklm\software\microsft\windows\currentve
rsion\uninstall\ (the add and
> remove programs list) put them into and array and then search the array
> for DisplayName key for an application?
>
> I am trying to determine if a product is installed, like Office XP.
>
> TIA.



Anthony

2004-09-27, 3:55 pm

y sakuda wrote:

> "Anthony" <nomorespam@msn.com> wrote in message news:%23dye3ByoEHA.3724@TK2MSFTNGP10.phx.gbl...
>
>
> Something like this?
> If your OS is'nt XP or Win2000Pro,I suppose you can't enumerate subkeys.
> Note: Some application don't have DisplayName
> Y Sakuda from JPN
>
> Const HKLM = &H80000002
> Dim oReg, SubKey, arrSubKeys, strKeyPath, wDisp
> Dim wKeyAry(), wDispAry(), I
> Set oReg = GetObject("winmgmts:root\default:StdRegProv")
> strKeyPath = " SOFTWARE\Microsoft\Windows\CurrentVersio
n\Uninstall"
> oReg.EnumKey HKLM, strKeyPath, arrSubKeys
> I = 0
> For Each SubKey In arrSubKeys
> ReDim Preserve wKeyAry(I)
> ReDim Preserve wDispAry(I)
> wKeyAry(I) = SubKey
> oReg.GetStringValue HKLM, strKeyPath & "\" & SubKey, "DisplayName", wDisp
> wDispAry(I) = wDisp
> wscript.Echo "KeyName=" & wKeyAry(I) & ", DisplayName=" & wDispAry(I)
> I = I + 1
> Next

Thanks for the reply, could you explain how this works?

Thanks.
Anthony

2004-09-27, 3:55 pm

Steven Burn wrote:

> Thats not a very reliable way of doing it.......
>
> You'd be much better off attempting to locate the programs folder, and doing
> a fileexists on it's executable.
>
> --
>
> Regards
>
> Steven Burn
> Ur I.T. Mate Group
> www.it-mate.co.uk
>
> Keeping it FREE!
>
>
> "Anthony" <nomorespam@msn.com> wrote in message
> news:#dye3ByoEHA.3724@TK2MSFTNGP10.phx.gbl...
>
>
>
>

Wouldn't that have to search the entire drive?
y sakuda

2004-09-27, 3:55 pm

"Anthony" <nomorespam@msn.com> wrote in message news:415812E8.6070203@msn.com...
> y sakuda wrote:
>
> Thanks for the reply, could you explain how this works?
>

Sorry, I'm not good at English to explain movement of script.
Please study StdRegProv yourself.
http://msdn.microsoft.com/library/d..._stdregprov.asp

There is many sample at Script Center
http://www.microsoft.com/technet/co...ry/default.mspx


rusga

2004-09-28, 3:57 am

Hi,

Yes it is possible, and IMHO the best way to do it.

Regards,
rusga

On Mon, 27 Sep 2004 06:20:20 -0700, Anthony <nomorespam@msn.com> wrote:

> Steven Burn wrote:
>
> Wouldn't that have to search the entire drive?


Steven Burn

2004-09-28, 8:55 am

Not at all.........

If you can get the path via the registry, there's no need to search the
whole drive (though even this can be acheived in seconds as you'd only need
to search the \Program Files\ folder).

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!


"Anthony" <nomorespam@msn.com> wrote in message
news:41581394.7020503@msn.com...
> Steven Burn wrote:
>
doing[color=darkred]
> Wouldn't that have to search the entire drive?



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com