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
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.
Can somebody help me in this?
Thanks in advance,
Suzanne
0 Comments
[ + ] Show comments
Answers (3)
Please log in to answer
Posted by:
Inabus
15 years ago
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
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.
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
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.