开发者

WIX: Windows Service Repair failing on lack of permissions + how to detecting repair mode?

Our WIX setup installs a windows service after asking logon account through a custom UI dialog.. The service starts after installation succeeds. Entire setup requires elevated privileges.

Hoping for any pointers regarding couple of questions:

Question 1 On attempting "Repair" from "Add/Remove Programs", UAC prompts for privilege elevation. After allowing so, the repair still fails with message:

"Service could not be installed. Verify that you have sufficient privileges to install system services".

Here's excerpt from code:

...

Privileged ...

  <Component Id="C_ServiceEXE" Guid="{105F9C86-BF07-43C8-8C78-DF30F012CD68}">
    <File Id="$(var.TargetFileN开发者_如何转开发ame)" Name="$(var.TargetFileName)" KeyPath="yes"  Assembly=".net"
          AssemblyManifest="$(var.TargetFileName)" AssemblyApplication="$(var.TargetFileName)" DiskId="1"
          Source="$(var.TargetDir)\$(var.TargetFileName)" />

    <Condition>Privileged</Condition>

    <ServiceInstall Id="Id_ServiceInstall"
                     Name ="$(var.ServiceName)"
                     Description="$(var.ServiceDescription)"
                     DisplayName="$(var.ServiceName)"
                     Account="[SERVICEACCOUNT]"
                     Password="[SERVICEPASSWORD]"
                     Start="auto"
                     ErrorControl="normal"
                     Type="ownProcess"
                     Vital="yes"
                     Interactive="no"
                     />

    <ServiceControl Id="Id_ServiceControl"
                    Name ="$(var.ServiceName)"
                     Remove="uninstall"
                     Start="install"
                     Stop="both"
                     Wait="yes"
                    />

  </Component>

...

I not quite sure why this is happening, since I admin am on on my Win7 dev box and have marked both the setup and speicifically the service install component to be run in privileged mode.

I suspect I might be missing scheduling repair inside an AdminInstallExecute sequence but not quite sure if that will fix this.

Question 2 Also, related question is - if repair does succeed, would it again require user to enter logon account via the UI. I'd rather suppress all interactive UIs during repair or upgrade. I realize that UPGRADINGPRODUCTCODE to detect upgrade.

But how is repair detected ?

Appreciate any help or pointers.


Maintenance mode most likely fails because your service user account doesn't have the right to log on as a service. It doesn't matter if you are an Administrator, you cannot install services for an user without giving him the log on right.

If setting this policy works, you also need to do it dynamically during install. A solution is to use ntrights.exe as a custom action. This custom action can use your custom properties which contains the user account information.

To detect a repair process, you can check the REINSTALL property value.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜