Read an MST file with vbscript

vbscriptwindows-installer

I'm trying to do a script that gets information out of some MSI and MST files and write it into a text file. I achieved reading the MSI files. However, I get the following message.

Msi API Error 80004005: OpenDatabase, DatabasePath, OpenMode
1:2219  2:  3:4:

I open the file like this

Set installer = Wscript.CreateObject("WindowsInstaller.Installer") : CheckError
Dim database : Set database = installer.OpenDatabase(FileName, msiOpenDatabaseModeReadOnly) : CheckError

It works just fine with MSI files. I believe MST files should be read in a different way.

How can a read an MST file using vbscript?

Best Answer

I haven't tried myself, but according to MSDN, to view a transform file (MST) you need to open your MSI database and then use the ApplyTransform method with the msiTransformErrorViewTransform parameter. This will give you a temporary _TransformView table, which you can query to get the desired information.

So, your code should look like this:

Const msiOpenDatabaseModeReadOnly    = 0
Const msiTransformErrorViewTransform = 256
Dim installer, database

Set installer = CreateObject("WindowsInstaller.Installer") : CheckError
Set database = installer.OpenDatabase(MSIFileName, msiOpenDatabaseModeReadOnly) : CheckError
database.ApplyTransform MSTFileName, msiTransformErrorViewTransform : CheckError
Related Topic