Thursday, July 23, 2009

List all installed product codes

If you ever need to retrieve the product code for installed Windows Installer products you can use the code below to retrieve it. Copy the code into a .vbs file and run it. It will produce an output file components.txt with all installed codes.

Option Explicit
Public installer, prod, a, fso

Set fso = CreateObject("Scripting.FileSystemObject")
Set a = fso.CreateTextFile("components.txt", True)

' Connect to Windows Installer object
Set installer = CreateObject("WindowsInstaller.Installer")
a.writeline ("Products")
For Each prod In installer.products
a.writeline (prod & " " & installer.productinfo (prod,"InstalledProductName") & " " & installer.productinfo (prod,
"VersionString") )
Next

Source of code was found in Acresso forums. The source file can also be downloaded from here.

Labels:

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home