/build/static/layout/Breadcrumb_cap_w.png

Reading an MSI Setup with VBScript

Using the "WindowsInstaller.Installer" object you can pull values from an MSI file (which is essentailly a database file) using a limited version of SQL syntax referred to as WQL

To get all properties within a given MSI...

Dim MSIobj, MSIdb, MSIView, MSIrecords

Dim propName, propValue

 

OnErrorResume Next

 

MSIfile = "C:\Users\BobKelly\Downloads\Firefox.msi"

Set MSIobj = CreateObject("WindowsInstaller.Installer")

Set MSIdb = MSIobj.OpenDatabase(MSIfile, 0)

Set MSIView = MSIdb.OpenView("SELECT Property,Value FROM Property")

 

MSIView.Execute()

PropCount = 0

Set MSIrecords = MSIView.Fetch

propValue = MSIrecords.StringData(2)

propName = MSIrecords.StringData(1)

 

Do While Err.number = 0

If propName <> "" Then

propCount = propCount + 1

WScript.Echo propName & " = " & propValue & Chr(13) & Chr(10)

End If

Set MSIrecords = MSIView.Fetch

propValue = MSIrecords.StringData(2)

propName = MSIrecords.StringData(1)

Loop

Comments

  • I've got some tutorials over here too, should anyone need them: http://www.alkanesolutions.co.uk/category/windows-installer/tutorials-vbscript-for-windows-installer/ - captain_planet 10 years ago
    • Wow, excellent stuff over here. Nice work! - bkelly 10 years ago
  • Just wow, Lot of good stuff shared. Thanks. - sarveshhh 8 years ago
This post is locked
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ