Davy
Wed Sep 17 15:40:14 CDT 2003
When I execute the following code:
<----------------------------------------------------------------------->
sComputer = "." ' 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")
Set 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
<---------------------------------------------------------------------->
I got an error on line 11.
What's wrong? OS -> XP
"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
news:3F68BACD.11DA98DC@hydro.com...
> Colin wrote:
>
> > What is the best way to detect which applications are installed on a
machine
>
> Enumerate e.g. the keys under
> HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall
>
>
http://groups.google.com/groups?selm=3E67CFA4.5FA75DBD%40hydro.com
>
>
> > and where the executable for the installed application resides.
>
> You will get some by enumerate the keys under
> HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths
>
> as well as enumerate all the shortcuts under the Programs menu and read
out the
> target property of them. You can do that from a vbscript using FSO and the
> CreateShortcut method (it can be used to open an existing shortcut).
>
> Note that the Start Menu\Programs is a merge of the Programs folder in the
user
> profile and the Programs folder for "All Users" profile.
>
> --
> 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
>
>