Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Enumerate installed software using StdRegProv

14 views
Skip to first unread message

Vedran Matica

unread,
Nov 14, 2003, 11:22:11 AM11/14/03
to
I have following script to enumerate all software displayed under Add/Remove
Programs in Control Panel. But, I don't know how to read the value of
DisplayName entry in each subkey (of course, if there is one).

Thanks a lot in advance,

Vedran

********************************************************

Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."

Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys

For Each Subkey in arrSubKeys
wscript.Echo SubKey
Next


Torgeir Bakken (MVP)

unread,
Nov 14, 2003, 11:30:43 AM11/14/03
to
Vedran Matica wrote:

> I have following script to enumerate all software displayed under Add/Remove
> Programs in Control Panel. But, I don't know how to read the value of
> DisplayName entry in each subkey (of course, if there is one).

Hi

sComputer = "name_or_ ip-address" ' use "." for local computer

MsgBox InstalledApplications(sComputer)


Function InstalledApplications(node)
Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
Set oRegistry = _
GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
& node & "/root/default:StdRegProv")
sBaseKey = _
"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
iRC = oRegistry.EnumKey(HKLM, sBaseKey, arSubKeys)
For Each sKey In arSubKeys
iRC = oRegistry.GetStringValue( _
HKLM, sBaseKey & sKey, "DisplayName", sValue)
If iRC <> 0 Then
oRegistry.GetStringValue _
HKLM, sBaseKey & sKey, "QuietDisplayName", sValue
End If
If sValue <> "" Then
InstalledApplications = _
InstalledApplications & sValue & vbCrLf
End If
Next
End Function


--
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/scriptcenter


Vedran Matica

unread,
Nov 15, 2003, 5:59:29 AM11/15/03
to
Thanks a lot,

Vedran


0 new messages