开发者

Running a process as the user that began the install, when creating a Deployment Project

I am creating a deployment project in Visual Studio 2010, and at the end of the install it needs to start a process as the user who began the install.

Since the install process requires elevated privileges to run, the process is being launched as the System user.

Is there any way to force a process to run during an install 开发者_运维知识库as the user who started the install? Is this information available?


Visual Studio deployment projects are MSI, or Windows Installer based. The installer usually elevates only when it needs to apply the modifications to the system, the steps when it collects data and the completion page are run as the current user, non-elevated.

Is the application at the end of install really started elevated?
If so, you would need a wrapper. The simplest way to start something unelevated is to keep the context of the current user. The wrapper firstly starts the install, which elevates at start; and after install finishes, it starts your application as the current non-elevated user.

Trying to start a non-elevated process from an elevated one is a tough and error-prone task. If you still want to follow this road, read the blog post How do I start a program as the desktop user from an elevated app?


Visual Studio setup projects run custom actions with no impersonation by default (msidbCustomActionTypeNoImpersonate). So the quickest solution would be to remove the no impersonation flag by editing the MSI with Orca.

Visual Studio is very limited when it comes to customizing an installation. This is why most complex products use other setup authoring tools.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜