Search code examples
wixwindows-servicescustom-action

WIX Toolset CustomAction to start Windows Service


Is it possible to start my installed Windows Service using a CustomAction? And is it possible to have a CustomAction to change the Start Type of the previously installed Windows Service?

I would really appreciate if anyone could guide me in the right direction!


Solution

  • You could write custom action code to start a service, yes, and being a C++ guy I would use the Win32 StartService API. But why do this? Windows Installer will do this with the StartServices action, with the WiX ServiceControl element. The only reason I know of to start a service with a CA after (say) InstallFinalize is because it has dependencies (assemblies in the GAC or Win32 SxS) that are not committed until after StartServices action.

    The recommended way to change the start type is with the WiX ServiceConfig element.