可以以有限的权限安装到程序文件中吗? [英] Is it possible to install into Program Files with limited privileges?

查看:63
本文介绍了可以以有限的权限安装到程序文件中吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个将作为MSI软件包(在WiX中编写)部署的应用程序.

I have an application that will be deployed as MSI package (authored in WiX).

我正在决定是否指定安装程序所需的elevatedlimited特权.

I am deciding whether to specify elevated or limited privileges as required for the installer.

除了默认安装位置(位于程序文件下)之外,该应用程序不包含任何需要提升特权的内容.

The application does not include anything requiring elevated privileges besides the default install location, which is under Program Files.

现在是问题:

  • 如果我指定提升的权限,则在安装过程中UAC会提示用户输入管理员密码.这不是必需的,它可以防止非管理员用户安装.

  • If I specify elevated privileges, then the user is prompted by UAC for administrator password during the installation. This is not required and prevents non-admin users from installing.

如果我指定了受限特权,则系统会向用户显示一个对话框,以选择默认为Program Files的安装位置.如果他们不更改安装位置(95%的最终用户可能不会更改),则安装程序将失败,并显示一条消息,提示他们应与管理员联系或以管理员身份运行该应用程序.如果他们以管理员身份启动安装程序,则可以毫无问题地安装到程序文件中-但是大多数用户可能不知道如何以管理员身份启动安装程序.

If I specify limited privileges, then the user is presented with a dialog to select install location with Program Files being default. In case they do not change the install location (95 % of end users probably won't), then the installer will fail with a message that they should contact the Administrator or run the application as administrator. If they launch the installer as Administrator then they can install into Program Files without problem - but most of the users won't probably know how to launch an installer as administrator.

我可以将默认安装位置设置为例如C:\ Company name \ Program \,但这对我来说似乎是非标准的,大多数用户可能不会这样(他们可能习惯于将其安装到Program Files中).

I can potentially set the default install location to e.g. C:\Company name\Program\, but this seems nonstandard to me and majority of users will not probably like this (they are probably used to installing into Program Files).

如何使用受限用户帐户安装应用程序来解决此问题?

推荐答案

您建议的直接位于C盘之外的其他位置也可能需要提升的特权.在Windows 7之前,我建议您使用早期的自定义操作来更改有限安装的默认位置.将其置于Privileged(或者可能是AdminUser)属性之外,验证是否需要为您的案例设置MSIUSEREALADMINDETECTION,并使用类似[LocalAppDataFolder]Company\Product的名称.不幸的是,这种方法会导致难以对所有用户进行安装,因为您必须预先将其标高,并且在有限的情况下,他们仍然可以选择需要标高的目标位置.它们必须预先抬高,因为包装必须标记为不抬高.

The alternate location you propose, directly off of the C Drive, is likely to also require elevated privileges. Before Windows 7, I would suggest using an early custom action to change your default location for limited installations. Condition it off of the Privileged (or possibly AdminUser) property, verify whether you need to set MSIUSEREALADMINDETECTION for your case, and use something like [LocalAppDataFolder]Company\Product. Unfortunately this approach will result in a package that is difficult to install for all users as you must pre-elevate, and in the limited case they could still select a target location that requires elevation. They must pre-elevate because the package must be marked to not elevate.

如果仅可以将Windows 7和更高版本作为目标,则可以有条件地将MSIINSTALLPERUSER设置为覆盖安装位置和海拔要求,而改为按用户安装.在这种情况下,系统可能会询问用户是否要为所有用户安装(需要提升)或仅为自己安装.可以将包装标记为高程,设置MSIINSTALLPERUSER将覆盖该包装并跳过UAC提示.

If you can target solely Windows 7 and later, you can conditionally set MSIINSTALLPERUSER to override the install location and the elevation requirement, and instead install per-user. In this scenario, the user could be asked whether to install for all users (requires elevation) or just for himself. The package can be marked for elevation, and setting MSIINSTALLPERUSER will override that and skip the UAC prompt.

这篇关于可以以有限的权限安装到程序文件中吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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