Is there a utility I can use to export all of the tables in 1 shot from an MSI file?

Thank You
0 Comments   [ - ] Hide Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity


If you download the Windows Installer SDK from the Microsoft website, it contains several scripts (in VBScript) to export tables from a MSI file to txt files.
Answered 09/18/2006 by: brenthunter2005
Fifth Degree Brown Belt

Please log in to comment
Thank You. I should have mentioned that I'm using Win2k. The SDK has a bunch of scripts, but as far as I can tell, none to actually extract the tables. :(

Thanks anyway.
Answered 09/18/2006 by: Secondlaw
Third Degree Blue Belt

Please log in to comment
Have a look at Msidb.exe,
The "-e" option will:
Export selected tables from database into text archive files in folder. Table names for export are table names. Only the wildcard specification, "*", may be used. Tables may be exported from a read only database.
Answered 09/18/2006 by: AngelD
Red Belt

Please log in to comment
Thanks a lot! I'll give this a try tomorrow morning!
Answered 09/18/2006 by: Secondlaw
Third Degree Blue Belt

Please log in to comment
Hi Secondlaw,

Try this VBScript, just add your preferred table

' Export File Table from a given MSI Database to an Excel Spreadsheet

Option Explicit

Const msiOpenDatabaseModeReadOnly = 0

On Error Resume Next
Dim installer : Set installer = Nothing
Dim szMSI

szMSI = InputBox("Enter MSI File (including full path)", "Select MSI", "")
DIM folder : folder = InputBox("Enter Folder to Write Table to...", "Select Export Folder","")

Set installer = Wscript.CreateObject("WindowsInstaller.Installer") : CheckError

Dim database : Set database = installer.OpenDatabase(szMSI, msiOpenDatabaseModeReadOnly) : CheckError

Dim table, view, record

table = "File"

Set view = database.OpenView("SELECT 'Name' FROM _Tables")
view.Execute : CheckError
Set record = view.Fetch : CheckError
If record Is Nothing Then Exit Do
Export table, folder : CheckError
Set view = Nothing

Export table, folder : CheckError


Sub Export(table, folder)
Dim file :file = table & ".xls"
database.Export table, folder, file
End Sub

Sub CheckError
Dim message, errRec
If Err = 0 Then Exit Sub
message = Err.Source & " " & Hex(Err) & ": " & Err.Description
If Not installer Is Nothing Then
Set errRec = installer.LastErrorRecord
If Not errRec Is Nothing Then message = message & vbNewLine & errRec.FormatText
End If
Wscript.Echo message
Wscript.Quit 2
End Sub

Hope this helps,
Answered 09/19/2006 by: knight
Orange Senior Belt

Please log in to comment

Thanks! That script is just about perfect. How would I configure that so I can run it from a command line...

cscript export.vbs <table> "<msipath>" "<outputfilepath>"
Answered 09/19/2006 by: Secondlaw
Third Degree Blue Belt

Please log in to comment
Hi folks,
one quick way to do this, is using ORCA. Load the MSI in ORCA, go to 'Tables' - 'Export Tables...' 'Select All'.
This is also an easy Editing method, if you have to edit tables in a vendor MSI.
Regards, Nick
Answered 09/20/2006 by: nheim
Tenth Degree Black Belt

Please log in to comment