user8114848
user8114848

Reputation: 173

Is it possible to passively install an .EXE but still show the GUI using Powershell?

Pretty much what the title says, is it possible to passively/silently install an .EXE using Powershell but still have the installer GUI show? I'd want the next's "clicked" automatically but would still like the GUI to be shown as sort of a progress indicator.

Upvotes: 2

Views: 4769

Answers (2)

Stein Åsmul
Stein Åsmul

Reputation: 42206

UPDATE: There is a Powershell module for Windows Installer. It can help to run msiexec.exe equivalent commands in easier fashion than to deal with Powershell's quirks.


MSI?: If this is an MSI inside an EXE wrapper, then the below will generally work. If it is just a normal EXE file you should repackage as Painter answers - or run it silently with the correct switches - if possible.


Suggestion: I would suggest this command line based on what you wrote (basic UI with modal box displayed at completion & hide the cancel button during installation):

msiexec.exe /I "setup.msi" /qb+!

Sample progress dialog with hidden cancel button:

progress dialog with hidden cancel button


Keystrokes: It sounds like you want the whole GUI wizard to show up with all the buttons "auto-magically" clicked? That is hard. Crazy tools such as AutoIt - the ones that push keystrokes to application windows - could do it, but that is about as reliable as your average house of cards. There are always error sources in such duct-tape approaches.

Silence!: I assume you know you can suppress the whole GUI for an MSI with standard command line switches for msiexec.exe? You can go for completely silent GUI or exactly a progress bar like you describe and many other combinations. You can even hide the cancel button. Nifty.

UILevel: MSI supports various "UILevels" - the installation can be varying degrees of interactivity from totally silent to fully interactive. There are 4 basic levels and various "modifiers" (show completion dialog or not). Here is an answer on the different UILevels in practice: Uninstall from Control Panel is different from Remove from .msi

Examples: Here are some further example command lines:

  • Totally silent, no GUI at all:

    msiexec.exe /i "setup.msi" /qn
    
  • Basic GUI with no modal dialog boxes and hidden cancel button:

    msiexec.exe /i "setup.msi" /qb-!
    
  • No GUI except a modal dialog box displayed at the end:

    msiexec.exe /i "setup.msi" /qn+
    

Note: There are several further combinations depending on how you configure things with the 4 different levels of GUI, the modal dialog at the end or not, and finally hide or show the cancel button.


Advanced: Beyond the normal use of msiexec.exe you can suppress the whole GUI of an MSI programmatically via the MSI Win32 API and instead handle the progress messages yourself.

WiX Bundles: This is the approach the WiX toolkit uses to deliver its own, modern GUI for bundles. Advanced Installer and Installshield and others have similar concepts. The integration with Windows Installer is all based on these API-calls.


Links:

Repackaging:

Upvotes: 4

Christopher Painter
Christopher Painter

Reputation: 55601

What your describing is the difference between fully silent (no ui) and non-interactive (has a UI but the user doesn't need to interact with it). If it is a best practices following MSI then what @SteinAsmul described is your ticket.

If it's a poorly written EXE based installer that didn't consider this use case and doesn't support it then you would have to "repackage" the installer (reverse engineer / rewrite ) the installer into an MSI so that it is supported

Upvotes: 0

Related Questions