How do I do a silent install and uninstall with WiX and MSI?

39,215

Solution 1

Just don't include any UI/UIRef elements and then no UI will be included :)

Solution 2

Windows Installer (MSI) uses the following command line arguments to be silent:

Silent install or silent major upgrade:

msiexec.exe /i foo.msi /qn

Silent minor upgrade:

msiexec.exe /i foo.msi REINSTALL=ALL REINSTALLMODE=vomus /qn

Silent uninstall:

msiexec.exe /x foo.msi /qn

Executable path:

C:\Windows\system32\msiexec.exe

Solution 3

Installer .exe's created with WiX can be run from the command line without requiring user input by using one of these command line parameters:

  • /quiet - Displays no UI whatsoever
  • /passive - Displays a UI but requires no user input. Essentially just displays an install progress bar

This answer is based on WiX 3.9.

Solution 4

All MSI installers whether created by WiX or not can be controlled via command line arguments. So you can make an installer with UI and still install it silently, there is no need to remove the UI from the installer just suppress it on the command line. Remember, make sure you add the upgrade element in your first installer so subsequent ones will match

Share:
39,215
MX4399
Author by

MX4399

Man+Machine

Updated on November 25, 2020

Comments

  • MX4399
    MX4399 over 3 years

    How can a silent installer be created in WiX that does not display any UI dialogs to the user and installs, upgrades and uninstalls with default settings?

  • Christopher Painter
    Christopher Painter almost 12 years
    That's of very limited value. Having a user double click on an MSI and it installs without any confirmation or status of results is a very suboptimal user experience IMO. It's fine if your part of a bunch of MSI's being changed together by another program handling the UI ( Think Visual Studio, SQL Server..) but if it's a stand alone MSI, I consider it a job only half done.
  • Benoit Martin
    Benoit Martin almost 12 years
    I agree it's definitely of limited value, but it does answer the OP. A better (or "correct") solution is to use msiexec parameters as you've detailed below.
  • nil
    nil about 11 years
    Using msiexec.exe with command line parameters specifying quiet mode with no-ui is the way to go.
  • midspace
    midspace about 11 years
    @Christopher Painter. Installing any application in an enterprise environment on hundreds of machines requires processes such as using Group Policy. Having a UI is suboptimal and waste of time forcing force staff to go and press keys on EVERY machine for a company, simply where a new app is required.
  • midspace
    midspace about 11 years
    Use the "msiexec.exe /i foo.msi /qn" already mentioned. Thus the UI is maintained for individual users and troubleshooting admins, and can be hidden for rollouts.
  • Christopher Painter
    Christopher Painter about 11 years
    I use SCCM to push installers out to 100,000 machines at a time. I assure you that no one is going around click Next. But they can if they really need/want to.
  • Christopher Painter
    Christopher Painter about 10 years
    The WiX upgrade element sets the UpgradeCode property and auhors a row in the Upgrade table. Technically the first MSI doesn't have to have an upgrade element. It only has to have the UpgradeCode property. If you forget to do this, there are tricks that involve a "fake" Upgrade table entry in subsequent MSI's with a custom action that sets the action property to the ProductCode of the first MSI. Try to avoid that though. :-)
  • Ed Bayiates
    Ed Bayiates almost 10 years
    When I tried this a UI was still included -- a small dialog that had a progress bar. I had to use 7zip to make a bootstrapper to unpack and execute the MSI with /qn.
  • Steztric
    Steztric almost 9 years
    Great answer. Slight issue is that if you have to authorise an installation through a UAC dialog, none is presented using /qn. However, if you use /qb you get the option to authorise it.
  • Christopher Painter
    Christopher Painter over 8 years
    That is functions as designed. Silent installs are by definition non-interactive and a UAC prompt is an interaction. Failure to click yes in 30 seconds will fail the install. Your calling process should already be elevated prior to invoking the install.
  • Vaibhav Jain
    Vaibhav Jain over 6 years
    I am also facing the same problem, when I tried running the MSI in full UI mode by double clicking on the MSI it prompts me a UAC(Program name, publisher: unknown, File Origin) and I need to choose yes to proceed with the installation but my need is to install the MSI using cmd msiexec command in non interactive mode(basically it should automatically take yes in UAC) but that is not happening in any case(/q /a /qn). I am using a tool to deploy the MSI on 100's of server and it internally creates a command (msiexec /i <MSI PATH> /qn) which leads to failure. Any one have solution for this ?
  • kudlatiger
    kudlatiger about 5 years
    How do I pass the installation path?