I am trying to set a pre-installed service's startup type to Automatic
, using WiX. Another task was to start the service on install, which I achieved with:
<ServiceControl
Id="ServiceRunningState"
Name="[Service Name]"
Start="install"
Stop="install"
Wait="yes" />
Now I would also like to set the startup type. I have tried the following (see answer):
<ServiceConfig
Id="ServiceStartup"
ServiceName="[Service Name]"
DelayedAutoStart="yes"
OnInstall="yes"
OnReinstall="yes" />
But this didn't change the startup type of the service (tested from Manual
startup type). And besides, I want the startup type to be Automatic
, not Automatic (Delayed Start)
.
Please note that I am trying to modify an existing service, so there is no ServiceInstall
element.
The two elements (ServiceControl
and ServiceConfig
) are children within a Component
parent element.
Any help is appreciated :)
Set the "DelayedAutoStart" parameter to "no", rather than "yes".
MSI doesn't support changing the startup type of a service that the package doesn't install.
ServiceConfig
doesn't let you get around that:Solved by editing the registry via
RegistryKey
, see example:Note service may appear as
Automatic (Delayed Start)
in Services GUI. However, after restarting, Services GUI displayed the service startup type asAutomatic
.