WiX - 安装Windows服务并授予权限

jon*_*ers 10 .net windows-installer windows-services wix

我们需要授予用户对已安装服务的"启动","停止"和"查询"状态的权限.

在WiX 2.0中,这个xml会起作用:

<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" />
Run Code Online (Sandbox Code Playgroud)

我们正在使用WiX 3.0,他们从Permission元素中删除了Service*属性,并且不再允许它成为ServiceInstall元素的子元素.

我们如何在WiX 3.0中获得相同的效果?

作为概述,我们需要:

安装服务:

  • 手动启动
  • 在Local System下运行为"ownProcess"
  • 与桌面非交互式
  • 停止卸载

授予"Everyone"用户访问权限:

  • 开始
  • 停止
  • 查询状态

在已安装的服务上.

Bla*_*ICE 18

文档说在ServiceInstall元素中使用它:

<util:PermissionEx
    User="Everyone"
    GenericAll="yes"
    ServiceChangeConfig="yes"
    ServiceEnumerateDependents="yes"
    ChangePermission="yes"
    ServiceInterrogate="yes"
    ServicePauseContinue="yes"
    ServiceQueryConfig="yes"
    ServiceQueryStatus="yes"
    ServiceStart="yes"
    ServiceStop="yes" />
Run Code Online (Sandbox Code Playgroud)

我没试过

util命名空间是 xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"

  • 我使用每个版本中提供的WiX.chm.它的索引和搜索很快找到了我的答案. (3认同)