Hi ALL,

I want to read data form MSI data base(for ex: summury information)
Application name
Application version
Product code
..
;;;
;;
etc..

plz any body can have vb script to do this plz share me.



Regards,
SKT
0 Comments   [ + ] Show Comments

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.

Answers

0
Download the Plaform SDK (I don't think the Windows Installer SDK is available separately any longer). In there will be a bunch of VBSs e.g. WIFeatur.VBS. You will also find many, many other examples using a popular search engine.
Answered 07/22/2010 by: VBScab
Red Belt

Please log in to comment
0
[:)][:)][:)][:)][:)][:)][:)][:)]
Answered 07/22/2010 by: King
Senior Yellow Belt

Please log in to comment
0
Hello skt,

u can try using the script listed below, it generates a .bak file u can open it in excel file

Option Explicit
Dim FS, TS, WI, DB, View
Dim ProductName, ProductCode, UpgradeCode, PackageCode
Dim ProductVersion, record
Dim Total
Dim Path_MSI_File, Path_Result_Folder, Report_Name,Path_Result_File
Set WI = CreateObject("WindowsInstaller.Installer")
Path_MSI_File = " "
Set FS = CreateObject("Scripting.FileSystemObject"):CheckError

Do 'ACCEPT INPUT UNTIL USER PRESSES CANCEL or X
Do 'ACCEPT PATH TO MSI FILE
Path_MSI_File = InputBox( _
"Please type in the complete path to the MSI for report generation." _
+ vbNewLine + vbNewLine + "Press Cancel or X to exit.", _
"C:\COMPLETE PATH TO MSI\My.MSI","C:\")
Loop Until ((FS.FileExists(Path_MSI_File) AND _
(FS.GetExtensionName(Path_MSI_File) = "MSI" OR FS.GetExtensionName(Path_MSI_File) = "msi" _
OR FS.GetExtensionName(Path_MSI_File) = "mSI" OR FS.GetExtensionName(Path_MSI_File) = "MSi" _
OR FS.GetExtensionName(Path_MSI_File) = "msI" OR FS.GetExtensionName(Path_MSI_File) = "mSi" _
OR FS.GetExtensionName(Path_MSI_File) = "MsI" OR FS.GetExtensionName(Path_MSI_File) = "Msi" _
)) OR Path_MSI_File = "")
If Path_MSI_File = "" Then Exit Do

Path_Result_Folder = InputBox("Please type in the path to the report generation output folder" _
+ vbNewLine + vbNewLine + "Last character must be a back-slash (\)." _
+ vbNewLine + vbNewLine + "Press Cancel or X to exit.", _
"C:\PATH TO REPORTS FOLDER\","C:\")
If Path_Result_Folder = "" Then Exit Do
If NOT (FS.FolderExists(Path_Result_Folder)) Then _
FS.CreateFolder(Path_Result_Folder)
Report_Name = InputBox("Please type in report's file name" _
+ vbNewLine + vbNewLine + "Do not type extension or trailing period (.)" _
+ vbNewLine + vbNewLine + "Press Cancel or X to exit.", _
"MsiReportName","File Name goes here")
If Report_Name = "" Then Exit Do
Path_Result_File = PAth_Result_Folder & Report_Name & ".bak"

Set DB = WI.OpenDatabase(Path_MSI_File,0)
PackageCode = DB.SummaryInformation.Property(9)
Set View = DB.OpenView("Select `Value` From Property WHERE `Property`='ProductName'")
View.Execute
Set ProductName = View.Fetch
Set View = DB.OpenView("Select `Value` From Property WHERE `Property`='UpgradeCode'")
View.Execute
Set UpgradeCode = View.Fetch
Set View = DB.OpenView("Select `Value` From Property WHERE `Property`='ProductCode'")
View.Execute
Set ProductCode = View.Fetch
Set View = DB.OpenView("Select `Value` From Property WHERE `Property`='ProductVersion'")
View.Execute
Set ProductVersion = View.Fetch
If Not ProductName Is Nothing Then
Set TS = FS.CreateTextFile(Path_Result_File):CheckError
' Write Product Column Headings to Text File
TS.Write vbNewLine
TS.Write "ProductName" + vbTab
TS.Write "UpgradeCode" + vbTab
TS.Write "ProductCode" + vbTab
TS.Write "PackageCode" + vbTab
TS.Write "ProductVersion" + vbTab
TS.Write vbNewLine
' Write Data to Text File
TS.Write ProductName.StringData(1)
TS.Write vbTab
TS.Write UpgradeCode.StringData(1)
TS.Write vbTab
TS.Write ProductCode.StringData(1)
TS.Write vbTab
TS.Write PackageCode
TS.Write vbTab
TS.Write ProductVersion.StringData(1)
TS.Write vbNewLine
TS.Write vbNewLine
End If
' Write Component Column Headings to Text File
Total = 0
TS.Write "ComponentCode" + vbTab
TS.Write "File Name" + vbTab
TS.Write "File Version" + vbTab
TS.Write "Install Condition" + vbTab
TS.Write vbNewLine
TS.Write vbNewLine

Set View = DB.OpenView("SELECT `Component`.`ComponentId`,`File`.`FileName`,`File`.`Version`" _
& ",`Component`.`Condition`" _
& " FROM `Component`,`File` WHERE `Component`.`Component` = `File`.`Component_`"):CheckError
View.Execute
Do
Set record = View.Fetch : CheckError
If record Is Nothing Then Exit Do
Total = Total + 1
' Write Component Data to Text File
TS.Write vbNewLine
TS.Write record.StringData(1)
TS.Write vbTab
TS.Write record.StringData(2)
TS.Write vbTab
TS.Write record.StringData(3)
TS.Write vbTab
TS.Write record.StringData(4)
Loop
View.Close()
TS.Close
Loop
Set WI = Nothing

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 & vbLf & errRec.FormatText
End If
Fail message
End Sub
Sub Fail(message)
Wscript.Echo message
Wscript.Quit 2
End Sub
Answered 07/22/2010 by: mayur_mak
Senior Purple Belt

Please log in to comment
0
P L E A S E use the CODE tag when posting code or other lengthy text. Thank you.
Answered 07/22/2010 by: VBScab
Red Belt

Please log in to comment
0
Hi Mayur mak,

First i want say you thx lots....


Its works fine superb...thx once again...

i will try to change it according to my stds. if any thing required i will gat back to you...
Answered 07/27/2010 by: skt
Orange Senior Belt

Please log in to comment
0
I want access DATA from MST like Tile & subject from summary information stream table. but i opened MST but there is no Table called Information stream.
Answered 08/09/2010 by: skt
Orange Senior Belt

Please log in to comment
0
If you had followed my advice of about two thousand years ago to read Phil Wilson's The Definitive Guide to Windows Installer, you would already know that that information isn't stored in the regular tables.

If you had equally followed by advice of about 2 weeks ago to download the Platform ASDK, you would have found a script called WiSumInf.VBS. Would you like to have a guess at what that script does?
Answered 08/09/2010 by: VBScab
Red Belt

Please log in to comment
0
[:@]
Answered 08/10/2010 by: skt
Orange Senior Belt

Please log in to comment
Answer this question or Comment on this question for clarity