10

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.

jonathanpeppers
  • 26,115
  • 21
  • 99
  • 182

1 Answers1

18

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"

BlackICE
  • 8,816
  • 3
  • 53
  • 91
  • Can you post the link to the documentation you're looking at? I've been going to wix.sourceforge.net, and it's been lacking for a lot of things. – jonathanpeppers Mar 04 '10 at 17:42
  • Actually found that in a forum, here is the link if you want to dig further and see what other gold you can find: http://sourceforge.net/mailarchive/forum.php?forum_name=wix-users&max_rows=25&offset=18&style=nested&viewmonth=200809&viewday=26 – BlackICE Mar 04 '10 at 19:27
  • 3
    I use the WiX.chm provided in each build. It's Index and Searching finds answers for me quickly. – Rob Mensching May 01 '10 at 22:10
  • to make the response full, remember to add the Reference to the WixUtilsExtension.dll – Assassin Feb 24 '13 at 00:34
  • 1
    @SzymonSasin : The correct name of the dll to reference is WixUtilExtension.dll – Roman Mueller Dec 05 '18 at 14:28