Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to interactive a silently installing msi? (Progress data and cancel it)

For some reason, we are delivering a product with our own install GUI, that means, we will run the msi installation silently background.

By using the MSI API "MsiInstallProduct", I can install the product silently, but I have no idea how can I get the progress data of this installation and how can I cancel it.

Anyone has some ideas?

like image 896
redjackwong Avatar asked Nov 02 '09 07:11

redjackwong


People also ask

How do I silence an MSI file?

If you are looking for complete silence then you also need the MSI to run in quiet mode. You achieve this by running the msiexec.exe with the /qn switch. This switch means quiet and no interface.

How do I install a program silently?

As you want to install the software silently, find the switch available for silent installation. Use this command to use the silent switch: "softwarename.exe /switch". Once you are done with the silent switch command, sit back and relax. Your software will get installed automatically.

Where is the silent install switch for MSI?

When you install an MSI file, you can be assured that certain parameters will exist, such as the silent parameter /quiet or /qn. You can get a list of the supported parameters in PowerShell or CMD by typing msiexec.exe /?. This command will display the usage statement.

What is silent mode MSI?

The traditional silent mode keeps your laptop at very low fan-noise level, but it will restrict the performance of the laptop, which will sometimes decrease your efficiency. The brand new Ambient Silent AI will detect the ambient sound level, and automatically adjust the fan speed to not exceed the surrounding noise.


2 Answers

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.


I believe you can get the progress via the MSI API, but if I were you I would just show the progress bar from the MSI itself after invoking the install via msiexec.exe.

MSI supports several different installation levels (full, completely silent, basic GUI, reduced GUI etc...). In your case it sounds like you want a basic UI. This yields a progress bar where you can hide the cancel button, and optionally show a completion modal dialog:

Install silently with progress bar, no cancel button and no modal dialog at end:

msiexec.exe /I "Test.msi" /QB-!

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.

enter image description here


Related:

  • installation using msi.exec open help options every time
  • Silent Install of MSI
  • How to install an MSI package from a command prompt
  • How do I force the Windows MSI installer to perform a complete install?
  • Silent Installer with custom selection
like image 184
Stein Åsmul Avatar answered Oct 06 '22 01:10

Stein Åsmul


You need to specify an external UI handler using MsiSetExternalUI or MsiSetExternalUIRecord before MsiInstallProduct (the latter is nicer, but has a higher MSI version requirement). The function you specify will be called for each message Windows Installer wants you to process. This will give you the data, and a chance to respond tell it to cancel. If you require MSI 4.5 or later, you can use an embedded external UI handler DLL, which does not require a bootstrap.

like image 36
Michael Urman Avatar answered Oct 06 '22 00:10

Michael Urman