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

4

40

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?

Lazare answered 24/5, 2010 at 17:42 Comment(0)
V
-2

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

Vanda answered 24/5, 2010 at 22:58 Comment(10)
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.Activism
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.Vanda
Using msiexec.exe with command line parameters specifying quiet mode with no-ui is the way to go.Putto
@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.Thermotherapy
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.Thermotherapy
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.Activism
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.Dilan
Unlike the up-voted answers, this one actually answers the question asked, and yet it's downvoted. I, and many other devs, know how to do this when calling msiexec from the commandline. My users don't run it from the commandline, but it runs automatically through GPO. The question was about WIX, not msiexec, people!Mesocratic
@Mesocratic And what do you do if your software should have an interactive setup, too? Create 2 installers? Seems stupid. Where is the problem with GPO to call msiexec with parameters?Ashanti
@TheincredibleJan That was not the question asked. Read: "created in WiX that does not display any UI dialogs"Mesocratic
A
78

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
Activism answered 24/5, 2010 at 19:28 Comment(3)
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.Wolverhampton
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.Activism
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 ?Monomer
L
25

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.

Labellum answered 16/7, 2015 at 20:3 Comment(1)
How do I pass the installation path?Literality
U
5

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

Unrighteous answered 25/5, 2010 at 7:19 Comment(1)
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. :-)Activism
V
-2

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

Vanda answered 24/5, 2010 at 22:58 Comment(10)
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.Activism
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.Vanda
Using msiexec.exe with command line parameters specifying quiet mode with no-ui is the way to go.Putto
@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.Thermotherapy
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.Thermotherapy
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.Activism
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.Dilan
Unlike the up-voted answers, this one actually answers the question asked, and yet it's downvoted. I, and many other devs, know how to do this when calling msiexec from the commandline. My users don't run it from the commandline, but it runs automatically through GPO. The question was about WIX, not msiexec, people!Mesocratic
@Mesocratic And what do you do if your software should have an interactive setup, too? Create 2 installers? Seems stupid. Where is the problem with GPO to call msiexec with parameters?Ashanti
@TheincredibleJan That was not the question asked. Read: "created in WiX that does not display any UI dialogs"Mesocratic

© 2022 - 2024 — McMap. All rights reserved.