3

We have several web sites that we deploy using an MSI package. One package per website.

This works fine manually:

  • we go into the control panel
  • uninstall the old version
  • then run the MSI, filling out some values, to install the new version

We would like to be able to run a batch file to do this.

  • Can this be automated?
  • How to uninstall the old version?
  • How to fill in the values that are normally added manually
3

You can use msiexec however you will likely end up re-writing that MSi with orca (or any other msi editor) WPKG is fairly worthless once you realize that any MSI can be automated if you've set up the MSI to take properties (set the MSi up to take PROPERTY=PropertyValue.) there are also some default properties that can be set (listed here). It's then as simple as running msiexec /qn /uninstall product.msi then msiexec /i product.msi /qn MYPROPERTY=propertyvalue. You can use pstools or powershell to run the commands remotely

4

msiexec.exe is the command-line program to install and uninstall MSI files. For automating it, I suggest WPKG which allows you to automate software installation, including MSIs. To fill in the values, I think you'll need to create a MST file, which can be done with several tools, including InstEd or Orca, then specify it on the command line with TRANSFORMS=package.mst.

2

There are good answers here, but I just want to add some clarifications:

  • Automatic uninstall: By authoring the Upgrade table inside the MSI to implement a "major upgrade" you eliminate the need to manually or separately uninstall the previous version. The install of the new MSI will then silently remove the old MSI prior to installing the new one. Here is a starting point for implementing a major upgrade: http://msdn.microsoft.com/en-us/library/aa372374(v=vs.85).aspx. It is also OK to invoke an uninstall of the old MSI via msiexec.exe, but I find it more elegant that the new MSI removes the old one automagically.
  • Command Line install: The msiexec.exe command line feature is very extensive and generally allows you to specify all required details for each MSI so that the install can happen silently. Only public properties (recognized by UPPERCASE captioning) can be specified at the command line. As stated before there are also "default properties" that can be set: http://support.microsoft.com/kb/230781

UPDATE June 2018: Although the tool shown below is no longer available for download, I found it via Wayback machine. I assume it is OK and legal to link to it, seeing as the tool was freeware. Updated links below.

UPDATE: This tool from Wise is regrettably not downloadable anymore. I am not sure if it is OK to distribute it either. It seemed to be a free tool distributed as part of their main Wise Package Studio suite, but I don't think it is open source. I wish they would release it as an open source tool.

The Wise packaging products have been discontinued due to a number of legal issues.


There is a tool available that helps you interactively build an msiexec.exe command line.

To avoid having to construct these silly msiexec command lines manually, use the msi command line builder tool from Wise: http://www2.wise.com/filelib/WICLB.exe (resurrected from Wayback machine).

Please run the download by virustotal.com for safety.

Sample screen from Wise's msiexec.exe command line builder

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.