开发者

MSI installer custom action identity problem

I'm creating a custom action that executes a script on a database. The problem is that the connectios uses intergrated security, so when I try to open the connection i get the error: Login Failed for user 'Domain\ComputerName$'.

When i check the identity on the custom action (using System.Security.Principal.WindowsIdentity.GetCurrent()) I always get "NT AUTHORITY\SYSTEM" but I'm running the installer under my account which has enough privileges on the Database.

How can I r开发者_开发知识库un the custom action under the real user runnig the msi file or solve this problem in any other way?


Well, there's a simple solutions for this but maybe it's not suitable for all cases.

If you set the project property of InstallAllUsers To true, the installer runs with "NT AUTHORITY\SYSTEM" Account, but if you set it to false it runs with the identity of the user who launches the installer.

Setting it to false worked for me, even that I was installing a Windows Service that runs for all users.


The short answer is that you're going to need to

  1. Enable 'impersonation' for the custom action.
  2. (On Windows Vista and Windows 7 systems) run the entire installation in an 'elevated' context (i.e. 'Run as Administrator').

How you accomplish #1 depends on what you are using to create the installation package. In order to easily deal with #2, I use a bootstrapper (created with Bootstrapper Manifest Generator) that is configured to run 'elevated'.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜