cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Script to generate MSI log with product version

Script to generate MSI log with product version

Summary

How to generate a log file with version number appending to msi verbose log.

Symptoms

When ever we install a msi the logfile will be created without the version number of installer, it will be helpful if the log file has version number append to the log file.

 

Resolution

You can execute the below vbscript code to set delete the unused component  from your project ism file. You can also write the same code using PowerShell also

You can run the script using vbs editor or you can run the script using “wscript.exe” in cmdlet.

Path to wscript.exe “C:\Windows\System32>wscript.exe”

Here is my sample script to install a msi package and generate log with version number,

Const msiOpenDatabaseModeReadOnly = 0
Dim msi, db, view, Test, strLog

Set oShell = WScript.CreateObject( "WScript.Shell" )

Set msi = CreateObject("WindowsInstaller.Installer")
Set db = msi.OpenDataBase("<Path to msi package>", msiOpenDatabaseModeReadOnly)
Set view = db.OpenView("SELECT `Value` FROM `Property` WHERE `Property` = 'ProductVersion'")
Call view.Execute()

GetVersion = view.Fetch().StringData(1)

Test = GetVersion
Wscript.Echo Test

CStr(Test)
Wscript.Echo Test
oShell.CurrentDirectory = "C:\Users\Administrator\Downloads\"
strLog = "C:\SetupMsilog_" & Test & ".log"
oShell.Run "TestComponent.msi /l*v " & chr(34) & strLog,0,True
Labels (2)
Was this article helpful? Yes No
No ratings
Version history
Last update:
‎May 14, 2020 03:06 AM
Updated by:
Contributors