Just a quickie today, someone wanted me to give them a list of all the files that were inside an Windows Installer (MSI) and I remembered that MSI's were databases (Access?) so:
Option ExplicitConst msiOpenDatabaseModeReadOnly = 0Dim installer : Set installer = NothingDim WshShell : Set WshShell = CreateObject("Wscript.Shell")Dim szMSI : szMSI = WScript.Arguments.Item(0)Dim folder : folder = WshShell.CurrentDirectorySet installer = Wscript.CreateObject("WindowsInstaller.Installer") Dim database : Set database = installer.OpenDatabase(szMSI, msiOpenDatabaseModeReadOnly) Dim View, RecordSet View = database.OpenView("SELECT FileName FROM File") 'could include FileSize, etcView.ExecuteDo Set Record = View.Fetch If Record Is Nothing Then Exit Do Wscript.Echo Record.StringData(1)LoopSet View = NothingWscript.Quit(0)
You call it like this: cscript WhateverFileName.vbs YourInstallerDatabase.msi
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. I am a failed stand-up comic, a cornrower, and a book author.
Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.