how to find out which products are installed – newer product are already installed MSI windows

ProductCode identifies a particular product. It changes every time you ship a new replacement product.
UpgradeCode defines a series of products by using the same UpgradeCode in a updated products whose versions are expected to continually increase. By default, new product versions replace older product versions with a major upgrade. Because upgradecode defines a product series, Windows will look for products with the same UpgradeCode because identical UpgradeCodes means mutually exclusiv products, using them to replace an older product with a new one. In WiX, major upgrade is done with the majorupgrade element which it appears you may be using because you get that “a newer version is installed” message. There is an AllowDowngrade option there if you want to “upgrade” to a lower version.

Product versions (like file versions) are not just useful information – they are used by the system with the understanding that new replaces old and generally it is a bad thing to go back to lower versions, that’s why the default behavior disallows downgrades.

This script might help. It uses the Windows Installer scripting API to enumerate all the installed products, showing version, user sid, ProductCode etc:

Option Explicit
Public installer, fullmsg, comp, prod, a, fso, pname, ploc, pid,contxt, sid, psorce, pcache, pvers

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

' Connect to Windows Installer object
Set installer = CreateObject("WindowsInstaller.Installer")
a.writeline ("Products")
'on error resume next
For Each prod In installer.ProductsEx("", "", 7)
   pid = prod.ProductCode
   contxt = prod.Context
   sid=prod.usersid
   pname = prod.InstallProperty("ProductName")
   psorce = prod.InstallProperty("InstallSource")
   ploc =prod.InstallProperty("InstallLocation")  
   pcache = prod.InstallProperty("LocalPackage") 
   pvers=prod.InstallProperty("VersionString")
   a.writeline (pid & " " & pname & " " & pvers & " installed at <" & ploc & "> from " & psorce & " Context " & contxt & " Local " & pcache)
Next

Leave a Comment