WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

WindowsInstaller

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

MST Viewer

 Keywords: MST MSI viewer Windows Installer WindowsInstaller WindowsInstaller.Installer COM  

Question:

I remember a while back that someone had actually created an MST viewer and I do believe an MST creator with Winbatch - does anyone have the source code or direct me to the correct Winbatch tools/Utilities to do so?

Answer:

Sorry I am unable to track down any source code. However you might be able to use WinBatch to communicate with the Windows Installer COM object.

http://msdn.microsoft.com/en-us/library/aa372851(VS.85).aspx

http://msdn.microsoft.com/en-us/library/aa372499(VS.85).aspx

The following example might contain some code that will be useful to you:

#DefineFunction NotePad(Title,Data)
   Temp = Environment("Temp")
   TempFile = Temp:"\":Title:".txt"
   FileDelete(TempFile)
   FilePut(TempFile,Data)
   RunWait("NotePad.exe",TempFile)
#EndFunction

oInstaller = CreateObject("WindowsInstaller.Installer")

Pause("Installer Version",oInstaller.Version)

; List Installed Products
Data = ""
ForEach prod In oInstaller.products
   ErrMode = ErrorMode(@OFF)
   ProductName = oInstaller.productinfo(prod,"InstalledProductName")
   ProductVersion = oInstaller.productinfo(prod,"VersionString")
   ErrorMode(ErrMode)
   Data = Data:ProductName:@TAB:ProductVersion:@CRLF
Next
NotePad("Installed Products",Data)

MSIFile = "C:\Windows\System32\webfldrs.msi"
oProduct = oInstaller.SummaryInformation(MSIFile)
oMSIData = oInstaller.OpenDatabase(MSIFile,0)

; List MSI File Summary Data
Pause("Title",oProduct.Property(2))
Pause("Subject",oProduct.Property(3))
Pause("Author",oProduct.Property(4))
Pause("Revision",oProduct.Property(9))

; List MSI File Properties
Data = ""
oView = oMSIData.OpenView("SELECT * FROM Property")
oView.Execute
While @TRUE
   oRecord = oView.Fetch
   If oRecord==0 Then Break
   PropertyName = oRecord.StringData(1)
   PropertyValue = oRecord.StringData(2)
   Data = Data:PropertyName:": ":PropertyValue:@CRLF
EndWhile
NotePad("MSI Properties",Data)

; List Files Within MSI File
Data = ""
oView = oMSIData.OpenView("SELECT * FROM File")
oView.Execute
While @TRUE
   oRecord = oView.Fetch
   If oRecord==0 Then Break
   FileName = oRecord.StringData(1)
   x = StrIndex(FileName,"|",1,@FWDSCAN)
   If x>0 Then FileName = StrSub(FileName,x + 1,-1)
   Data = Data:FileName:@CRLF
EndWhile
NotePad("MSI File List",Data)

Article ID:   W18205
Filename:   MST Viewer.txt
File Created: 2009:03:05:16:03:28
Last Updated: 2009:03:05:16:03:28