Getting Property Info via vbscript to text file

  • Thread starter Thread starter Ben Jooste
  • Start date Start date
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,
 
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!
 
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
 
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!!!
+++++++++++++++++++++++++++++++++++++++++++++++++++++
 
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
 
Back
Top