7
votes

I am trying to create a wix installer to install and start a Windows Service under NetworkService account, but failed, what I got is "Service"() could not be installed. Verify that you have sufficient privileges to install system services."

Please advice, my code is as below:

<Component Id="service" Guid='myguid'>
          <File Id='JobServiceEXE' Name='JobService.exe' DiskId='1' Source='mypath\JobService.exe' KeyPath='yes' />
          <ServiceControl Id="JobService" Name="[SERVICEID]" Stop="uninstall" Remove="uninstall" Wait="yes" />
          <ServiceInstall
          Id="JobService" Name="[SERVICEID]" DisplayName="[SERVICENAME]" Type="ownProcess"  Start="auto" ErrorControl="normal" Vital ='yes'
          Account="NT Authority\NetworkService"
          Description="Job Service" />
        </Component>

Thank you!

3

3 Answers

17
votes

Paul's response is not correct. As per MSDN documentation, to specify the Network Service account, use "NT AUTHORITY\NETWORK SERVICE":

...the name of the account must be

NT AUTHORITY\NETWORKSERVICE

when you call CreateService or ChangeServiceConfig, regardless of the locale...

Set the property "ALLUSERS" to force an Administrator install.

see this link for further information

3
votes

First, the message you're getting may be due to a security issue. Your installer must be run by an administrator because creating services requires administrative privileges. You might check for that in a Condition element.

Second, using NT Authority\NetworkService as the account name will fail on non-English systems, because built-in account names are localized. Instead, use plain old NetworkService which Wix recognizes specially and resolves into the correct localized name.

1
votes

I've been having this one on Windows 7 and it was bugging me for ages. I fixed it by adding

InstallScope="perMachine"

To my package element:

<Package Description="..."
         Manufacturer="Microsoft Corporation"
         InstallerVersion="200"
         Languages="1033"
         Compressed="yes"
         InstallScope="perMachine"/>