/build/static/layout/Breadcrumb_cap_w.png

How to fetch Directory Table values using VBScript

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

Answers (3)

Posted by: Inabus 15 years ago
Second Degree Green Belt
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
Posted by: jmcfadyen 15 years ago
5th Degree Black Belt
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.
Posted by: anonymous_9363 15 years ago
Red Belt
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.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ