Reputation: 116868
I am working on a new Wix installer.
Install the windows service using that new user.
<!-- Create User -->
<util:User Id="UpdateUserLogonAsService" UpdateIfExists="yes" CreateUser="yes" Name="ServiceUser" PasswordNeverExpires="yes" Password="secret" />
<ServiceInstall Id="ServiceInstaller"
Type="ownProcess"
Vital="yes"
Name="Windows:service"
DisplayName="Windows service install"
Description="test"
Start="auto"
Account="ServiceUser"
Password="secret"
ErrorControl="ignore"
Interactive="no" />
<ServiceControl Id="StartService"
Start="install"
Stop="both"
Remove="uninstall"
Name="Windows:service"
Wait="yes" />
Creating the User works, Installing the service works as long as I use my current login and password. But as soon as I try and use the new user I get the following error message.
Verify that you have sufficient privileges to install system service
I have tried running the msi as administrator and it doesn't change the error still appears. I am guessing it has something to do with my not having permissions to install a service to run under another use. But that's a guess.
Upvotes: 3
Views: 3221
Reputation: 99
In addition to LogonAsService, you need to specify it's a local machine account:
Account=".\ServiceUser"
Upvotes: 2
Reputation: 55571
You need to grant the user the SeServiceLogonRight right using the LogonAsService as attribute of the Util::User element.
FWIW, that error message is very generic and usually wrong because Windows Installer can't possibly know why your service failed to respond (start) correctly. You may have other problems ( such as your service writing to a directory that your account has permissions to that the service account doesn't ) but at a minimum you have this problem.
Here's some fun. While on that screen, go into Services.msc and manually switch the service to SYSTEM and back to the account. You should get a prompt saying that the account has been granted the right. Then hit Retry on your dialog. If the install works, that was your only problem.
This right can be seen in the group policy editor. The install will seem to work from then on because the right is already set externally thanks to Services.msc. Revert the VM or remove the right using group policy and the problem will come back. Fix the installer, rebuild and retest and the right should automatically get applied by WiX during the install.
Upvotes: 3