你能强制 MSI 始终为管理员吗?
据我研究并询问其他人,似乎常规 MSI 在大多数时间都以有限用户身份运行,尤其是在 GUI 阶段。
但无论如何,该应用程序在安装阶段都需要提升提示,并且我希望在 GUI 选择阶段执行的自定义操作期间拥有管理员权限。难道真的没有办法强制一开始就出现UAC提示吗?
此外,还需要在 Active Directory 安装期间执行一些自定义操作,并且如果 MSI 作为来宾或其他方式运行,则也无法执行这些操作。
As far as I have researched and asked other people, it seems that regular MSI runs as limited user for most of the time, especially during GUI phases.
But the application requires elevated prompt during install phase anyway, and I would love to have admin rights during custom actions that are performed during GUI selection phases. Is there really no way to force the UAC prompt right at the beginning?
Also, some custom actions need to be performed during Active Directory install as well, and also cannot be done if the MSI runs as guest or something.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
即使运行提升的安装程序,自定义操作在 Vista、Server 2008 和 Windows 7 上仍可能失败。这是因为它们通过模拟提升进程的用户来运行。
需要完全权限且不使用每个用户信息的自定义操作应标记为无需模拟即可运行。这样它们就可以在本地系统帐户下运行,没有任何限制。
Custom actions may still fail on Vista, Server 2008 and Windows 7 even when running an elevated installer. This is because they run by impersonating the user which elevated the process.
Custom actions which require full privileges and don't use per-user information should be marked to run without impersonation. This way they run under the local system account with no restrictions.
您可以从 bootstrapper 启动 MSI,其中包含适当的嵌入清单。
You can launch your MSI from a bootstrapper, which contains appropriate manifest embedded.
在启动条件中使用特权属性。
Use the Privileged Property in an lauchcondition.
在 GUI 阶段,它始终在非提升的用户上下文中运行。在延迟执行模式下,仅会提升 InstallExecuteSequence 中的自定义操作。
要解决此问题,您应该重新设计 MSI 或使用引导程序 (setup.exe) 在启动时请求提升
http://msdn.microsoft.com/en-us/magazine/cc163486.aspx#S7
During GUI phase it always runs in non-elevated user context. Only custom action in the InstallExecuteSequence are elevated in deferred execution mode.
To fix this either you should re-design your MSI or use a bootstrapper (setup.exe) which request elevation at the startup
http://msdn.microsoft.com/en-us/magazine/cc163486.aspx#S7