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
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 withTRANSFORMS=package.mst
.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
There are good answers here, but I just want to add some clarifications:
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.