How to Set/Get a property via a VBScript Custom Action?
You can either use the Session object or simply use the ‘Property’ keyword to set a property via a vbscript custom action:
e.g Session.Property(“ARPNOCOMPONENT”)=”1″
Property(“REINSTALL”)=”ALL”
To get the value of a property, you can use the following e.g.
dim myvar
myvar = Property(“INSTALLDIR”)
MsgBox(myvar)
How to Set ‘INSTALLDIR’ property via a VBScript CA?
You will not be able to set the value of INSTALLDIR by using the ‘Property’ keyword through vbscript as the package uses the directory table to store the value of INSTALLDIR. Thus you will have to use the ‘TargetPath’ method of the ‘Session’ Object to achieve this. Follow the example below to reset the value of INSTALLDIR via your custom action:
dim myvar
myvar = “C:\newpath\newfolder”
Session.TargetPath(“INSTALLDIR”)=myvar
Note: When changing the value of INSTALLDIR in the UI Sequence, be sure to place the above custom action after the CostFinalize Standard Action.
How to Enable Logging inside an msi package?
In msi 3.1 and older, you can create a vbscript custom action to enable logging within the package. You can use the EnableLog Method of the Session object to achieve this. However, do remember that this custom action should be placed in the UI Sequence of the package in order for logging to take place. Thus if the package is run in silent mode, the log file will not be created as the custom action will be skipped. Following is an example that shows you how to achieve this:
Set Installer = CreateObject(“WindowsInstaller.Installer”)
Installer.EnableLog “wearcmpvo”, “C:\temp\setup.log”