1

I need to do different actions in installer if user runs the MSI from CMD and from GUI. Does someone knows how I can distinguish in run-time whether MSI was launched from Windows Explorer or CMD (unattended installation)?

The reason why I need to know this is that I need to make installer that will be executed in Unattended mode only if some parameter is set or in UI mode if user agreed with what I'm enforcing.

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
  • Your explanation is not 100% clear. Normally a silent mode installation is kicked off with command line parameters set on the command line. Something like this: http://stackoverflow.com/questions/22166534/silent-installer-with-custom-selection/22170346#22170346 – Stein Åsmul Mar 18 '14 at 23:43
  • Yes, that's odd. Silent is specified by the command line to the MSI, not really by the internals of the MSI. If it's not really silent as specified by the command line then Windows will believe it can show error messages, files-in-use dialogs etc, so it won't really be silent. You should consider implementing unattended install the standard way, otherwise you're asking how to do something that people don't actually do - you're inventing your own functionality. – PhilDW Mar 19 '14 at 16:28

1 Answers1

4

This is a "deployment smell" ala "code smell". Please explain what needs to be differently done, and why. There may be another way to achieve the same effect that doesn't mess with the core of the setup.

The UILevel property of Windows Installer will tell you whether the setup has been launched silently. Four different UI levels are possible.

Determining UI Level from a Custom Action.

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
  • It's possible that your setup is not optimally designed if you need to figure this out, or it's got incorrect code somewhere. You may need to post the actual problem you're trying to solve rather than ask the question that seems to indicate you have decided the solution is find out if it's a silent install. One example is that if you have a message in your code that you don't want to show because it's a silent install, then you are using the wrong API. – PhilDW Mar 18 '14 at 16:50