Getting Property Info via vbscript to text file

B

Ben Jooste

Hi Everyone,

I am trying to learn vbscript to make things easier in our environment.

I am looking for a bit of code or suggestions, on how to access the msi
database throug a vbscript and extract property information into a
README.txt file for documentation purposes.

If you have any info on how to do it, please respond.

Regards,
 
M

Michael Sanford [MVP]

Hi Ben,

The Platform SDK contains a whole directory chock full of fun examples for you
to play with and learn from. One script in particular, WiRunSql.vbs, allows you
to run arbitrary SQL commands against an msi database.

Good Luck!
 
B

Ben Jooste

Thanks for that Michael.
I can see how to use sql statements within the msi and how to access the
database.

Do you know how to read a value and write it to a text file say from the
property table
ben
 
M

Michael Sanford [MVP]

Hmm... You're no asking me to write this for you, are you???

'Untested "Air Code":
Dim FS, TS, WI, DB, View, Rec
Set WI = CreateObject("WindowsInstaller.Installer")
Set DB = WI.OpenDatabase("C:\mypackage.msi",2)
Set View = DB.OpenView("Select `Value` From Property WHERE `Property` =
'MyProperty'")
View.Execute
Set Rec = View.Fetch
If Not Rec Is Nothing Then
Set FS = CreateObject("Scripting.FileSystemObject")
Set TS = FS.CreateTextFile("C:\Test.txt")
TS.Write Rec.StringData(1)
TS.Close
End If

--
R. Michael Sanford
Windows Installer MVP
+++++++++++++++++++++++++++++++++++++++++++++++++++++
ActiveInstall Professional 2.0 -- Windows Installer Made Simple!
Visit http://www.activeinstall.com and download a trial today!!!
+++++++++++++++++++++++++++++++++++++++++++++++++++++
 
B

Ben Jooste

Cheers for that man!!!!
You've helped me a lot. I will now go and get to work.. get the rest done.
Thanks again.

Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top