Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install and start a Windows Service under NetworkService account by using WiX?

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!

like image 295
Ray Avatar asked Jan 05 '10 00:01

Ray


People also ask

How do I create a WiX Windows Installer?

Adding a WiX setup project In Visual Studio, open your solution, and add a WiX project to it: go to the Visual Studio main menu and click File -> Add -> New Project to open the Add New Project dialog. Choose the Setup Project item in the Windows Installer XML node, specify the project name and click OK.

How do I know if I have WiX toolset installed?

The best way to check if you have WiX Toolset installed is by opening up the Command Prompt and trying to execute the light.exe command. You can also check in the Programs and Features section of Control Panel.


1 Answers

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

like image 184
Marc Avatar answered Oct 05 '22 11:10

Marc