prerak6962
Posts: 112
Joined: Mon Dec 08, 2014 5:26 pm

Conditional Credentials for Service User

Fri Dec 11, 2020 5:57 pm

Hello,

I have a very unique requirement for one of our projects.

In the installer, the user can select the type of database he wants to install. The possible options are:
1. SQLite3
2. MS SQL

The project also contains a service. What we want is if the user selects SQLite3 in one of the dialogs, the service should be installed to run under LocalSystem account. But if the user selects MS SQL, he'll provide the credentials for it (username and password) and the same credentials should be used to run the service now.

So, is there a way I can conditionally set how to run the service (LocalSystem account or user account) based on the user input?

Thank you.
Prerak

Catalin
Posts: 4428
Joined: Wed Jun 13, 2018 7:49 am

Re: Conditional Credentials for Service User

Thu Dec 17, 2020 5:00 pm

Hello Prerak,
So, is there a way I can conditionally set how to run the service (LocalSystem account or user account) based on the user input?
Unfortunately, I'm afraid we do not have predefined support for that.

I'd say that the best approach would be having two custom actions:

- one that creates & starts the service under a normal user

- one that creates & starts the service under the LocalSystem account

Both custom actions should be scheduled after the "Add resources" action group, with their execution time being set to "When the system is being modified (deferred)".

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”