Win Server 2008 上的 UAC 让我头疼!
我的安装程序部署了一个配置 exe,用于在也安装的 Windows 服务上进行一些基本配置。该exe还需要创建和写入一些注册表项。在 Windows Server 2008 环境中无法创建这些密钥。我已经调查并发现这是管理员权限,并且该 exe 不会提示输入 2008 年 UAC 下所需的管理员权限。我可以通过右键单击该 exe 并以管理员身份运行来解决此问题。但这并不理想,因为这是我需要通知客户执行的额外步骤。运行exe时还有其他方法提升管理员权限吗?
My installer deploys a configuration exe which is used to do some basic configuration on a windows service which is also installed. The exe also needs to create and write some registry keys. On a Windows server 2008 environment these keys can't be created. I have investigated and found that this is an Administrator privilege, and the exe isn't prompting for Admin permissions which are needed under UAC on 2008. I can work around this by right clicking the exe and running as Administrator. This isn't ideal however as its an extra step I need to notify our clients of performing. Are there any other ways of elevating the admin permissions when running the exe?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将清单放在 exe 上或与 exe 一起放置。如果您让我知道您正在使用的版本,我可以告诉您如何使用 Visual Studio 嵌入清单。如果您不使用 Visual Studio,或者不构建 exe,那么您可以将清单文件放在与 exe 相同的文件夹中,这样也可以。在这种情况下,该文件的名称必须与您的 exe 相同,并以 .manifest 结尾,例如,对于 foo.exe,它是 foo.exe.manifest。内容应如下所示:
请注意,requestedExecutionLevel 的可能值都在注释中,并且此值使用 requireAdministrator。现在它总是会提升,因此对你有用。
Put a manifest on or with the exe. I can tell you how to embed the manifest using Visual Studio if you let me know what version of that you're using. If you're not using Visual Studio, or you don't build the exe, then you can just put the manifest file in the same folder as the exe and that will work too. In that case the file must be named the same as your exe, with .manifest on the end, eg for foo.exe it's foo.exe.manifest. The content should look like this:
Notice the possible values for requestedExecutionLevel are all here in a comment, and this one uses requireAdministrator. Now it will always elevate and therefore work for you.