How to install an MSI package from a command prompt

automated-installmsi

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

Best Answer

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