How can I retrieve and set properties with VB script?

book

Article ID: 180836

calendar_today

Updated On:

Products

Symantec Products

Issue/Introduction

 

Resolution

Question
How do I retrieve and set properties set a property in VB script?

Answer

Properties needed for a Windows Installer installation to complete can be set at runtime using VB script. The code is relatively simple and makes use of the session object of the Windows Installer service.

In order to use the following code, execute VB scripts using a custom action in the .MSI. Use any of the VB Script custom actions when calling the VB script.

To retrieve a property value from the Windows Installer use this code:
myvariable=session.property("myproperty')

To set a property use this code:
session.property("myproperty")=value

The four types of custom actions available for calling VB scripts are:

- Call VBScript from Installation. This stores the script in the Binary table and extracts the script to a temporary location at runtime. Please note that the user installing your package must have permission to write files to the temporary location.

- Call VBScript from Embedded Code. This stores the script as code embedded in the custom action itself.

NOTE: Wise for Windows Installer 3.52 called this action Call VBScript stored in a Custom Action.

- Call VBScript from Installed Files. This installs a .VBS script as part of the installation and then executes the script from the destination machine. This action must be run after the InstallFiles action, ideally after InstallFinalize.

- Call VBScript from Property. This stores the script inside another Windows Installer property.

For more information about any of these custom actions, please see the topics titled "'Custom Action Reference," "Tips on Custom Action Location," and "Using .MSI Script" in the Wise online help topics.

NOTE: Users of Wise for Windows Installer 3.52 should see the topic titled "Custom Actions" in the Wise online help topics.