在不同的上下文中从MSI(wix)作为普通用户执行进程

时间:2023-02-15 16:21:56

I'm trying to configure an installer for some software we use within the company.

我正在尝试为公司内部使用的某些软件配置安装程序。

The installer is pushed out to target machines via SMS, and it performs the following steps:

安装程序通过SMS推送到目标计算机,并执行以下步骤:

  1. Terminate any currently running instances of the app (the app is a utility, so this isn't an impact on the user).
  2. 终止当前正在运行的应用程序实例(该应用程序是一个实用程序,因此这不会对用户产生影响)。

  3. Remove the previous version.
  4. 删除以前的版本。

  5. Install the updated version.
  6. 安装更新版本。

What we want it to do is launch the installed executable (as the currently logged in user, not the system account which the SMS job runs as) once step 3 is completed.

我们希望它做的是在步骤3完成后启动已安装的可执行文件(作为当前登录的用户,而不是SMS作业运行的系统帐户)。

I've tried adding a custom action as follows:

我尝试添加自定义操作如下:

<CustomAction Id="Relaunch" Impersonate="yes" Return="asyncNoWait" FileKey="AppExeFile" Execute="commit" ExeCommand="acm" />

And in the InstallExecuteSequence element I have the following:

在InstallExecuteSequence元素中,我有以下内容:

<Custom Action="Relaunch" OnExit="success" />

However when we try this, either as a SMS job or executing as an administrator nothing happens (e.g. the app isn't relaunched).

但是,当我们尝试此操作时,无论是作为SMS作业还是作为管理员执行都没有任何反应(例如,应用程序未重新启动)。

Any suggestions?

2 个解决方案

#1


The solution I've come up with is to start our utility using the Run registry key at login, and to prevent launching the utility during install if the current user is "SYSTEM" - this wasn't specifically with SMS but using AD/GPO deployment. However some of our customers are using SMS and this was the solution that worked for them.

我提出的解决方案是在登录时使用Run注册表项启动我们的实用程序,并防止在安装期间启动实用程序,如果当前用户是“SYSTEM” - 这不是专门用于SMS而是使用AD / GPO部署。然而,我们的一些客户正在使用SMS,这是适合他们的解决方案。

Similar issues with Vista/Server 2008 UAC, the only reliable solution I've come up with there is to schedule a reboot so that when the user logs back in the utility is launched under the correct user context.

与Vista / Server 2008 UAC类似的问题,我提出的唯一可靠的解决方案是安排重启,以便当用户重新登录该实用程序时,在正确的用户上下文下启动。

I've done a fair bit of research and looking through MSI documentation and it seems that de-elevating privileges to launch a background utility as another user is not really possible.

我做了一些研究并查看了MSI文档,似乎降低了启动后台实用程序的权限,因为另一个用户实际上是不可能的。

#2


Unfortunately it would seem this isn't possible - I suppose it might be an option to write an extension for the MSI which does what I need in code some how - although it seems like a lot of work for a little reward.

不幸的是,似乎这是不可能的 - 我想这可能是为MSI编写扩展的选项,它在代码中做了我需要的一些方法 - 虽然看起来很多工作需要一些奖励。

What we've decided to do is use SMS to send out a chained package - the primary one which executes our application, which first depends on the installer being run.

我们决定使用SMS发送一个链式包 - 执行我们的应用程序的主要包,它首先取决于正在运行的安装程序。

Hope this helps someone else :)

希望这可以帮助别人:)

#1


The solution I've come up with is to start our utility using the Run registry key at login, and to prevent launching the utility during install if the current user is "SYSTEM" - this wasn't specifically with SMS but using AD/GPO deployment. However some of our customers are using SMS and this was the solution that worked for them.

我提出的解决方案是在登录时使用Run注册表项启动我们的实用程序,并防止在安装期间启动实用程序,如果当前用户是“SYSTEM” - 这不是专门用于SMS而是使用AD / GPO部署。然而,我们的一些客户正在使用SMS,这是适合他们的解决方案。

Similar issues with Vista/Server 2008 UAC, the only reliable solution I've come up with there is to schedule a reboot so that when the user logs back in the utility is launched under the correct user context.

与Vista / Server 2008 UAC类似的问题,我提出的唯一可靠的解决方案是安排重启,以便当用户重新登录该实用程序时,在正确的用户上下文下启动。

I've done a fair bit of research and looking through MSI documentation and it seems that de-elevating privileges to launch a background utility as another user is not really possible.

我做了一些研究并查看了MSI文档,似乎降低了启动后台实用程序的权限,因为另一个用户实际上是不可能的。

#2


Unfortunately it would seem this isn't possible - I suppose it might be an option to write an extension for the MSI which does what I need in code some how - although it seems like a lot of work for a little reward.

不幸的是,似乎这是不可能的 - 我想这可能是为MSI编写扩展的选项,它在代码中做了我需要的一些方法 - 虽然看起来很多工作需要一些奖励。

What we've decided to do is use SMS to send out a chained package - the primary one which executes our application, which first depends on the installer being run.

我们决定使用SMS发送一个链式包 - 执行我们的应用程序的主要包,它首先取决于正在运行的安装程序。

Hope this helps someone else :)

希望这可以帮助别人:)