Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WiX - Install Windows Service and give permissions

We are required to give a user permissions to Start, Stop, and Query status of an installed service.

In WiX 2.0, this xml would have worked:

<ServiceInstall
    Id="ServiceInstaller" Type="ownProcess"
    Name="$(var.ServiceName)" DisplayName="$(var.ServiceName)" Description="Our service description"
    Start="demand" Account="LocalSystem" ErrorControl="ignore" Interactive="no">
    <Permission User="Everyone" ServiceQueryStatus="yes" ServiceStart="yes" ServiceStop="yes" />
</ServiceInstall>
<ServiceControl Id="StopService" Stop="both" Remove="uninstall" Name="$(var.OmniVpnServiceName)" Wait="yes" />

We're using WiX 3.0, and they removed the Service* attributes from the Permission element, and no longer allow it to be a child of a ServiceInstall element.

How do we get the same effect in WiX 3.0?

As an overview, we need:

Install a Service with:

  • Manual startup
  • Runs under Local System as "ownProcess"
  • Non-interactive with desktop
  • Stops on uninstall

Give the "Everyone" user access to:

  • Start
  • Stop
  • Query Status

On the installed service.

like image 979
jonathanpeppers Avatar asked Mar 04 '10 17:03

jonathanpeppers


People also ask

What is WiX Installer used for?

Windows Installer XML Toolset (WiX, pronounced "wicks"), is a free software toolset that builds Windows Installer packages from XML. It consists of a command-line environment that developers may integrate into their build processes to build MSI and MSM packages.

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

Documentation says use this inside the ServiceInstall element:

<util:PermissionEx
    User="Everyone"
    GenericAll="yes"
    ServiceChangeConfig="yes"
    ServiceEnumerateDependents="yes"
    ChangePermission="yes"
    ServiceInterrogate="yes"
    ServicePauseContinue="yes"
    ServiceQueryConfig="yes"
    ServiceQueryStatus="yes"
    ServiceStart="yes"
    ServiceStop="yes" />

I haven't tried it

util namespace is xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"

like image 73
BlackICE Avatar answered Sep 22 '22 00:09

BlackICE