Jump to content

This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.

Query Installed MSI 'database'

2 replies to this topic


  • Full Members
  • 12 posts

Posted 24 October 2007 - 10:43

I'm looking to see if a msi is installed, i know the product code but i'm not sure how i would check.

I'd like to do it by vbscript and i'm wondering if there is a 'master' database of all installed MSIs that i could search?

Anybody able to shed light on this (or have alternative ideas?)



  • Full Members
  • 436 posts

Posted 24 October 2007 - 11:00

The 'database' is in the registry. ARP principally uses the HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall keys to build its list so that's a good place to start.

Note that there are no built-in tools in VBS for enumerating registry keys: I have a component in VBS class form and in WSC form if you'd like them, but a Google search will turn up similar ones. Try 'VBScript +cRegistry' or 'VBScript +clsRegistry' as search terms.

Having said that, you don't need to do that to check a single product, if you have that product's Product Code.

Windows Installer exposes a bunch of properties and methods which VBS can use. Create the object like this:

Set objInstaller = CreateObject("WindowsInstaller.Installer")

You test a product's installed state like this:

strProductCode = "{0EEAF4A2-B2D4-4BDC-A3FB-E38751CBC24D}"
intInstalledState = objInstaller.ProductState(strProductCode)

where 'intInstalledState' should be one of:

Const msiInstallStateNotUsed = -7
Const msiInstallStateBadConfig = -6
Const msiInstallStateIncomplete = -5
Const msiInstallStateSourceAbsent = -4
Const msiInstallStateInvalidArg = -2
Const msiInstallStateUnknown = -1
Const msiInstallStateBroken = 0
Const msiInstallStateAdvertised = 1
Const msiInstallStateRemoved = 1
Const msiInstallStateAbsent = 2
Const msiInstallStateLocal = 3
Const msiInstallStateSource = 4
Const msiInstallStateDefault = 5

Here endeth the lesson. I suggest you browse MSDN for further details. There are good example scripts around on the Web.
- Don't know why 'x' happened? Want to know why 'y' happened? ProcMon will tell you.
- Try using http://www.google.com before posting.
- I answer questions only via forums. Please appreciate the time I give here and don't send me personal emails.


  • Full Members
  • 12 posts

Posted 24 October 2007 - 11:32

perfect - merci buckets.