tags:

views:

414

answers:

1

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?

+2  A: 

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
Helen
After doing some more research, I had to do exactly what you suggest. The good thing is that if you don't commit the changes applied by the MST file, the MSI file stays the same in disk.
tou