Question

I am using Wix to install a windows service. The service will need to run under a non system/service account that is set up by the user.

Is it possible to have it prompt for the username/password for the service login?

Was it helpful?

Solution

WiX doesn't (or at least didn't) have anything nice out of the box for what you are looking for. Best option that I am aware of is to roll-your-own.

http://www.geekproject.com/showtopic.aspx?ID=94

OTHER TIPS

The Community MSI Extensions on GitHub contains a ServiceCredDlg dialog for prompting username and password. According to the docs, it can test the credentials are valid and that user has 'logon as a service' rights.

Yes, but it's not built-in. You can setup a GUI in WiX (which is not too intuitive) where you can prompt for any setting you'll need in later steps.

First, check out how to create a GUI that sets custom properties by following these guidelines, ensuring that your GUI fills properties SERVICEACCOUNT and SERVICEPASSWORD. Then use the ServiceInstall element with those properties as shown here.

You can set PUBLIC PROPERTIES (uppercase) with the credentials on the command line and use these to install the service.

msiexec.exe /I "setup.msi" /QN USER="username" PASS="password"

A custom action can also be used to retrieve these values from the user during an interactive install, but if you do this remember to make the display of the message obey the setups UILevel value. Showing a message box from a custom action in a silent install is considered a serious setup error:

  • INSTALLUILEVEL_NONE 2 Completely silent installation.
  • INSTALLUILEVEL_BASIC 3 Simple progress and error handling.
  • INSTALLUILEVEL_REDUCED 4 Authored UI, wizard dialogs suppressed.
  • INSTALLUILEVEL_FULL 5 Authored UI with wizards, progress, errors.

Perhaps the best option is to show the dialog in an interactive install, and refuse to install silently if these properties aren't set on the command line. This is a simple custom action to test the values of the USER and PASS properties.

And obviously it is not recommended to use user accounts to run services.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top