What is the best way to detect which applications are installed on a machine
and where the executable for the installed application resides. Since I'm
working with older machines many of the applications were not installed with
the windows installer specs.

Re: List installed applications by Torgeir

Torgeir
Wed Sep 17 14:49:33 CDT 2003

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



Re: List installed applications by Davy

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



Re: List installed applications by Torgeir

Torgeir
Wed Sep 17 16:05:23 CDT 2003

Davy wrote:

> 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 = _

change

Set sBaseKey = _

to

sBaseKey = _


The function in the link I supplied has the latter line and should work...

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