Reading filenames and paths from MSI file
We have a policy that no information is to be entered into the selfreg, typelib, class, progid etc. tables due to problems with Active Directory.
It is often necessary for us to move data from these tables directly into the registry table. This is fine but when there are hundreds of files this is wasting a lot of time and it is easy to miss something.
I have now created a script which will generate a regfile for import into wise and this works fine but it is still necessary to hunt each file down and run a script to generate the regfiles. If I could somehow extract all of the filenames from the selfreg table, get the paths to these files and export this information to a text file I could incorporate this into the script to automatically grab all selfreg information and create a regfile to be imported into wise.
How can I extract all of the filenames from the selfreg table, get the paths to these files and export this information to a text file from OUTSIDE of the MSI?
It is often necessary for us to move data from these tables directly into the registry table. This is fine but when there are hundreds of files this is wasting a lot of time and it is easy to miss something.
I have now created a script which will generate a regfile for import into wise and this works fine but it is still necessary to hunt each file down and run a script to generate the regfiles. If I could somehow extract all of the filenames from the selfreg table, get the paths to these files and export this information to a text file I could incorporate this into the script to automatically grab all selfreg information and create a regfile to be imported into wise.
How can I extract all of the filenames from the selfreg table, get the paths to these files and export this information to a text file from OUTSIDE of the MSI?
0 Comments
[ + ] Show comments
Answers (1)
Please log in to answer
Posted by:
Garrett
19 years ago
Maybe a place to start...
From [link]http://www.serverwatch.com/tutorials/article.php/1548261[/link]...
From [link]http://www.serverwatch.com/tutorials/article.php/1548261[/link]...
' File Export v 1.0
' Export File Table from a given MSI Database to an Excel Spreadsheet
' J.Loomes Nov 2000
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
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.