CSI_INI2MST.vbs - Programmatically Creating MSI Property Transforms (MSTs) Using an INI File and a Script Print E-mail

Most everyone is familiar with creating Windows Installer Transforms (.MSTs) using an authoring tool.  CSI_INI2MST.vbs allows you to create transforms using just an INI file - or a whole set of INI files!  First let's talk about the usefulness of being able to create MSTs using a script and an INI file...

When To Use Code To Build a Transform

Here are several scenarios where programmatically creating MSTs can be helpful (if you've found others please contact us):

  • Allow a local site or region to customize centrally managed .MSIs without a full authoring tool license while also avoiding ORCA.  ORCA allows many things beside properties to be editted.  Orca also risks accidental alteration of the .MSI if the transform is not correctly specified before editing.
  • On the fly transform generation by deployment scripts that have access to information about the machine being deployed to.  The alternative is to use properties on the command line during deployment, however, application settings in properties on the command line do not make it through to HKCU when the real user activates the application and receives their HKCU self-heal.  By contrast, properties in a transform are available during this self-heal event.
  • Any tool, utility or scripting language that can generate an INI (and the individuals skilled in these tools) can now create a transform programmatically.
  • Possible implementation of a central customization database that outputs INIs for mass MST creation in cases where many variations of an MSI must be supported.

Flexible Syntax and Operation

Here are some of the aspects of CSI_INI2MST.vbs that make it flexible and powerful:

  • Can discover INIs in the folder it runs from (no script arguments) or a folder or list of folders given on the command line.
  • It can take an individual INI or list of INIs on the command line.
  • You can combine both a list of INIs and folders on the command line - they can be relative (to the script folder) or absolute paths.
  • The generated MST will have the same name and folder location as the INI that generated it, except if you manually code an MST name into the INI.
  • Manually coding an MST name into the MST allows the MSTs to be in a different folder than the INI that creates it.
  • When an MST that matches the name specification of an INI file already exists, it will only be regenerated if the INI file has a newer modified date than the MST. (Has been updated since the original MST was created).
  • The script will prompt for INI values that are set to blank.
  • You can force a specific prompt by setting a property to "/PThis is the prompt text"  (e.g. SERIALNUMBER=/PType The Serial Number)
  • Generated transforms have no MSI validation flags and work with any .MSI
  • Zip contains several sample INIs to demonstrate capabilities.

Command Line Samples

       - Searches script folder for all INIs and processes them

CSI_INI2MST.vbs properties.ini
CSI_INI2MST.vbs v:\test\properties.ini
      - process properties.ini and create a transform named properties.mst
         in the same folder as the INI if the INI does not specify another name

CSI_INI2MST.vbs v:\test
      - process all INIs in v:\test and generates transforms in the same
        folder as the INI if the INI does not specify another name

CSI_INI2MST.vbs testfolder,properties.ini,v:\test,v:\mstinis\abc.ini
     - process all INIs in testfolder (subfolder of script folder),
       processes properties.ini in script folder, processes all inis in
       v:\test and processes v:\mstinis\abc.ini and generates transforms
       in the same folder as the INI if the INI does not specify another name.

But It Only Does Properties!

That is correct!  It needs to stay simple.  If you currently have per-site or per-region package customization that requires editing other parts of an MSI package, you may wish to re-engineer them so that they retrieve all their customization data from properties - then this solution will work for them as well. (It's actually a best practice anyway ;)

In the Zip File

The zip file also includes some INI file samples to demonstrate how various processing options work.

Where's The PowerShell?

PowerShell cannot directly access the MSI scripting objects responsible for package manipulation (the MSI WMI provider has never allowed for package creation / modification) so VBScript is the solution of choice for this activity.

Download this file (CSI_INI2MST.zip)CSI_INI2MST.zip[ ]11 Kb