I’m trying to use Wix4 to deploy a Windows service. I want to make use of the Windows virtual service account feature. However I’m hitting a significant block.
The following code will install the service, but it fails to start.
<Component>
<File Source="$(var.QControlServer.TargetDir)QControlServer.exe" />
<ServiceInstall Id="QControlServerService" Name="QControlServer" DisplayName="QControl Server" Description="QControl server application"
Start="auto" Type="ownProcess" ErrorControl="normal" Account="NT ServiceQControlServer" Vital="yes" Interactive="no"/>
<ServiceControl Id="QControlServerService" Name="QControlServer" Start="install" Stop="both" Remove="uninstall" Wait="yes"/>
</Component>
I did some digging and it looks like the virtual service account doesn’t have the Logon As a Service right assigned to it by default. If I wait for my installer to complete the service installation, then manually grant it the right the service will start. Great – but I can’t find a way to assign those rights at the right time within Wix4.
There is a potential option to use the util extension included within Wix.
<util:User UpdateIfExists="yes" CreateUser="no" Name="NT ServiceQControlServer" LogonAsService="yes" />
Unfortunately I can’t figure out how to specify to run this only after the ServiceInstall has completed. It would need to run after the service is installed and before the service start is attempted. From looking at the execution sequence it appears that these tasks happen one after the other, which is fine. But I simply can’t figure out how to drop the util:User extension action inbetween. The block appears to allow me to specify that something should happen before or after a given activity, but then it seems like that can only link to a custom action, which in turn appears to only be an external executable rather than the built-in Wix extension. I really don’t want to have to hand craft and deploy additional executables to complete these actions, it just seems excessive given that it should be possible within Wix’s capabilities.
Does anyone have any pointers as to how I can make this flow work?
Trikkitt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.