Hi,

Is there anyways to fetch the property of a "MSI" or "MST" usingVBscript?

Below mentioned in red color is what I exaclty wanna do using VBscript.

"I want to fetch "DefaultDir" column values of Directory table using VBScript."

Can somebody help me in this?

Thanks in advance,
Suzanne
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
My advice to you would be to download the Windows Installer SDK. In amongst the folders will be some script samples, most of which will show you the technique for querying MSI tables.A good one to start from would be WiFileVer.VBS.
Answered 09/29/2008 by: VBScab
Red Belt

Please log in to comment
2


Set objDirectoryDict = CreateObject("Scripting.Dictionary")
Set objInstaller = CreateObject("WindowsInstaller.Installer")
Set objDatabase = objInstaller.OpenDatabase("<NAME OF MSI>",0)
Set objDirectoryTable = objDatabase.OpenView("Select `DefaultDir` FROM `Directory`")
objDirectoryTable.Execute
i = 0
Do
Set objDirectoryObjects = objDirectoryTable.Fetch
If objDirectoryObjects Is Nothing Then Exit Do
objDirectoryDict.Add i,objDirectoryObjects.StringData(1)
i = i + 1
Loop
colKeys = objDirectoryDict.Keys
For Each strKey In colKeys
MsgBox objDirectoryDict.Item(strKey)
Next


This will give you a dictionary object called objDirectoryDict which you can query to retrieve all the required DefaultDir values for the given MSI, I am querying the information to a message box atm, you can do what you want with it :)

P
Answered 09/29/2008 by: Inabus
Second Degree Green Belt

Please log in to comment
2
if you wanted to do this during installation which is what I suspect you are after you would need ot make a small mod to inabus's solution.

objInstaller = session.installer

this will give you installer access in much the same as as inabus got with this

Set objInstaller = CreateObject("WindowsInstaller.Installer")
Set objDatabase = objInstaller.OpenDatabase("<NAME OF MSI>",0)

session object is only available during the immediate phase, data can be pushed across to the deferred phase if you need it during writes to the system but thats another story I will leave unless you want it.
Answered 10/01/2008 by: jmcfadyen
Fifth Degree Black Belt

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