Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not enough permissions to install service

I have the following declaration of my service:

<ServiceControl Id="ServiceStartStop"
                Name="[name]"
                Start="install"
                Stop="both"
                Remove="both"
                Wait="no"/>
<ServiceInstall Id="ServiceRegister"
                Name="[name]"
                DisplayName="[displayname]"
                Description="[description]"
                Account="LocalSystem"
                Arguments="-start"
                ErrorControl="critical"
                Interactive="yes"
                Start="auto"
                Type="ownProcess"
                Vital="yes" >
  <util:PermissionEx  User="Authenticated Users"
                      ServiceChangeConfig = "yes"
                      ServiceEnumerateDependents = "yes"
                      ServiceInterrogate = "yes"
                      ServicePauseContinue = "yes"
                      ServiceQueryConfig = "yes"
                      ServiceQueryStatus = "yes"
                      ServiceStart = "yes"
                      ServiceStop = "yes"
                      ServiceUserDefinedControl = "yes" />
</ServiceInstall>

This compiles and links without any errors or warnings. The service exe is properly specified using KeyPath="yes". When I run my msi, it can't get beyond at 'Starting Service...'. I get an error message, as follows:

enter image description here

The UAC is shown when I click 'Install', so what's going wrong?

like image 586
fredley Avatar asked Mar 06 '12 16:03

fredley


2 Answers

The ServiceInstall Account must be fully qualified, as such:

<ServiceInstall ... Account="NT AUTHORITY\LocalService" />

It can fail if only specified like this:

<ServiceInstall ... Account="LocalService" />

like image 189
Chris Schiffhauer Avatar answered Oct 06 '22 14:10

Chris Schiffhauer


I had the same problem, it was caused by an earlier version of the service still running on the system. To fix this launch an elevated command line prompt and type:

 SC delete NameOfService
like image 31
Mister Cook Avatar answered Oct 06 '22 15:10

Mister Cook