msi table conversion
Is there a utility I can use to export all of the tables in 1 shot from an MSI file?
Thank You
Thank You
0 Comments
[ + ] Show comments
Answers (7)
Please log in to answer
Posted by:
brenthunter2005
18 years ago
Posted by:
Secondlaw
18 years ago
Posted by:
AngelD
18 years ago
Posted by:
knight
18 years ago
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
Do
Set record = view.Fetch : CheckError
If record Is Nothing Then Exit Do
Export table, folder : CheckError
Loop
Set view = Nothing
Export table, folder : CheckError
Wscript.Quit(0)
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,
knight
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
Do
Set record = view.Fetch : CheckError
If record Is Nothing Then Exit Do
Export table, folder : CheckError
Loop
Set view = Nothing
Export table, folder : CheckError
Wscript.Quit(0)
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,
knight
Posted by:
Secondlaw
18 years ago
Posted by:
nheim
18 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.