One of our products had the need to create a windows service running as “NetworkService” user.
So we did it the simple way and created the following (wrong) script:
<Component Id="cmpVipeService" Guid="PUT-GUID-HERE">
<!-- CreateFolder is necessary for components without files -->
<File Id="filServiceExecutable" Source="$(var.VipeService.TargetPath)" KeyPath="yes"/>
<ServiceInstall Id="srvVipeService" Name="VIPE [INSTANCE_NUMBER] Service" Start="auto" Type="ownProcess"
<ServiceControl Id="StartsrvVipeService" Name="VIPE [INSTANCE_NUMBER] Service" Start="install" Wait="no" />
<ServiceControl Id="StopsrvVipeService" Name="VIPE [INSTANCE_NUMBER] Service" Stop="both" Wait="yes" Remove="uninstall" />
Testing on a local PC and a test server worked fine, as WIX_ACCOUNT_NETWORKSERVICE has been translated to “NT
AUTHORITY\NETWORK SERVICE” or “NT AUTORITÄT\NETZWERKDIENST” (in German) and the service has been installed successfully. The only difference between existing (NetworkService) users and our service has been the written username “NT AUTORITÄT\NETZWERKDIENST”.
Result: Test completed inside our domain.
Yesterday we started to deploy the software to the production environment on a dedicated internet server hosted externally (and therefore not included in our domain). And (as expected) we failed. The following error has been reported in the event log with the id NETLOGON – 3095 (Sorry, in German):
Dieser Computer ist als Mitglied einer Arbeitsgruppe konfiguriert, nicht als Mitglied einer Domäne. Der Anmeldedienst braucht bei dieser Konfiguration nicht gestartet zu sein.
In english: The computer is a member of a workgroup, not a domain. The NETLOGON service doesn’t need to be run.
As a result the installation failed.
On day with unsuccessful research I finally analized an existing 3rd party tool that installs a service with a NetworkService login as well. The solution was simply not to put WIX_ACCOUNT_NETWORKSERVICE but “NT AUTHORITY\NetworkService” for the Account parameter.
Windows MSI API translates this value automatically into the local representation (i.e. NetworkService or Netzwerkdienst, …). After changing the parameter and running the installation again the software package has been installed successfully.