Windows安装程序使用NT AUTHORITY \ SYSTEM代替登录用户 [英] Windows installer using the NT AUTHORITY\SYSTEM instead of login user

查看:81
本文介绍了Windows安装程序使用NT AUTHORITY \ SYSTEM代替登录用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Windows安装程序,它会在安装过程中创建数据库.在安装应用程序CREATE DATABASE时,过程失败,因为Windows安装程序使用了错误的用户.它使用的是NT AUTHORITY\SYSTEM而不是登录用户. NT AUTHORITY\SYSTEM用户无权创建数据库.

I have a windows installer, which is creating a database as a part of the installation process. While installing the application CREATE DATABASE process is failing because the windows installer using a wrong user. It is using NT AUTHORITY\SYSTEM instead of using the login user. NT AUTHORITY\SYSTEMuser does not have permission to create a database.

有什么方法可以强制安装程序使用登录用户?

Is there any way to force the installer to use the login user?

在VS 2017和MS Visual Studio 2017安装程序项目中使用Windows 10环境.

Using Windows 10 environment with VS 2017 and MS Visual Studio 2017 Installer Projects.

推荐答案

简短的答案是,您无法在作为InstallAllUsers安装程序的Visual Studio安装程序中执行此操作,因为所有VS安装程序生成的自定义操作均作为系统运行帐户.因此,您需要使用Orca等编辑工具来更改MSI文件中的自定义操作设置.您会在MSI文件的CustomAction表中找到自定义操作,查看Type值(可能是3074类型),然后关闭msidbCustomActionTypeNoImpersonate位,使其以安装用户的身份运行.

The short answer is that you can't do this in a Visual Studio setup that is an InstallAllUsers setup because the all VS installer generated custom actions run as the system account. Therefore you'd need to change the custom action settings in the MSI file with an editing tool such as Orca. You'd find the custom action in the CustomAction table in the MSI file, look at the Type values (it's probably a type 3074) and then turn off the msidbCustomActionTypeNoImpersonate bit so that it runs impersonated as the installing user.

https://msdn.microsoft.com/zh-CN/library/windows/desktop/aa368069(v=vs.85).aspx

请注意,模拟为安装用户的运行有其自身的问题,因为它与以交互用户的运行不同.用户配置文件未加载,因此与用户关联的对象(例如HKCU,用户配置文件文件夹)非常不可靠.

Note that running impersonated as the installing user has its own set of issues because it is NOT the same as running as the interactive user. The user profile is not loaded, so objects associated with the user (such as HKCU, user profile folders) are very unreliable.

许多人在第一次启动应用程序时用单独的程序填充数据库,以便它可以作为交互式用户正常运行,并且可以作为独立程序进行开发和调试.如果在安装过程中填充失败,则要么放弃安装并回滚,要么继续安装并最终得到一个空数据库,为此您可能仍需要一个程序来填充该数据库.

Many people populate the databases with a separate programs the first time the application is launched so that it runs properly as the interactive user and can be developed and debugged as a standalone program. If the populate fails during the install you either give up the install and roll back, or you continue the install and end up with an empty database, for which you might need a program to populate it anyway.

这篇关于Windows安装程序使用NT AUTHORITY \ SYSTEM代替登录用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆