Can wix prompt for a windows service username/password?

9.8k views Asked by At

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?

4

There are 4 answers

0
Chris Baxter On BEST ANSWER

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.

https://www.geekproject.com/post/wix-service-account-dialog/

0
steinar On

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.

0
Stein Åsmul On

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.

0
David Gardiner On

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.