WIX:如何区分管理员组成员和内置管理员

发布于 2024-11-01 07:09:55 字数 1502 浏览 1 评论 0原文

我的安装对于管理员和普通用户来说应该有不同的行为(不同的安装目录等)。同时它应该适用于 XP、Vista 和 Windows 7。

安装程序的工作原理与我对 XP 和 Vista 的预期一样,但它无法检测 Windows 7 上的管理员用户。

我将 MSIUSEREALADMINDETECTION 设置为 1 以确保特权是仅为管理员用户设置。

<Property Id="MSIUSEREALADMINDETECTION" Value="1" />

作为管理员用户,以下条件在 Vista 上不会失败,但在 Vista 上失败

<Condition Message="Not Privileged">Privileged</Condition>

这是测试项目(我知道它不完整:)

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="0b241708-eb30-4bd9-9906-983f228ee2a6" Name="wixTest01" Language="1033" Version="1.0.0.0" Manufacturer="wixTest01" UpgradeCode="1093efb2-75d0-499a-8050-99adfc8ae7c2">
    <Package InstallerVersion="200" Compressed="yes" />

    <UI>
      <UIRef Id="WixUI_InstallDir" />
    </UI>

    <Property Id="MSIUSEREALADMINDETECTION" Value="1" />
    <Condition Message="Privileged">Privileged</Condition>

  </Product>
</Wix>

更新:

我刚刚发现了这个:

http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Admin-check-in-Win-2008-td4557002.html

我在Vista和Windows 7上创建的管理员(管理员组的成员)。我以为这些帐户是相同的,但事实并非如此。

内置管理员的属性 Privileged 设置为 1,而管理员组的成员则没有。

好像没有办法检测Administrators组的成员?

My installation should behave differently for admin and regular user (different installation directory etc). At the same time it should work for XP, Vista, and Windows 7.

The installer works as I would expect for XP and Vista, yet it fails to detect admin user on Windows 7.

I set MSIUSEREALADMINDETECTION to 1 to be sure that Privileged is set only for admin users.

<Property Id="MSIUSEREALADMINDETECTION" Value="1" />

As admin user the following condition does not fail on Vista, yet it fails on Vista

<Condition Message="Not Privileged">Privileged</Condition>

Here is the test project (I know it's incomplete:)

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="0b241708-eb30-4bd9-9906-983f228ee2a6" Name="wixTest01" Language="1033" Version="1.0.0.0" Manufacturer="wixTest01" UpgradeCode="1093efb2-75d0-499a-8050-99adfc8ae7c2">
    <Package InstallerVersion="200" Compressed="yes" />

    <UI>
      <UIRef Id="WixUI_InstallDir" />
    </UI>

    <Property Id="MSIUSEREALADMINDETECTION" Value="1" />
    <Condition Message="Privileged">Privileged</Condition>

  </Product>
</Wix>

UPDATE:

I've just found this:

http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Admin-check-in-Win-2008-td4557002.html

I used built-in Administrator account on Vista and a created admin (members of the Administrators group) on Windows 7. I thought that these accounts are the same, yet they are not.

A built-in administrator has its property Privileged set to 1, while members of the Administrators group don't.

It seems that there is no way to detect a members of the Administrators group?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

踏雪无痕 2024-11-08 07:09:55

正如您链接到的线程中所述,这是启用 UAC 时的标准行为。通过 UAC 同意提示,管理员组的成员只能按需获得提升的权限;在其他时候,他们几乎是标准用户(或多或少)。

As described in the thread you link to, that's standard behavior when UAC is enabled. With the UAC consent prompt, members of the Administrators group get elevated permissions only on-demand; at other times, they're pretty much standard users (more or less).

盗梦空间 2024-11-08 07:09:55

不必担心设置 MSIUSEREALADMINDETECTION,这是针对 AdminUser 属性的。

我使用以下代码:

<Condition Message="Privileged">
    <![CDATA[Installed OR Privileged]]>
</Condition>

但是,由于 Vista 和 Windows 7 具有“肩负”身份验证功能(请参阅 将 Windows Installer 与 UAC 结合使用 MSDN 文档)用户在 InstallUISequence 期间没有提升权限,您将遇到问题。

例如,标准用户运行安装程序,只有当他们点击“安装”按钮(带有 UAC 防护罩)时,系统才会提示他们输入管理凭据,因此您知道管理员是否会在安装过程的早期提供或不提供它们。

Don't worry about setting MSIUSEREALADMINDETECTION, that's for the AdminUser property.

I use the following code:

<Condition Message="Privileged">
    <![CDATA[Installed OR Privileged]]>
</Condition>

However, as Vista and Windows 7 feature "over the shoulder" authentication (refer Using Windows Installer with UAC MSDN Documentation) the user doesn't have elevated Privileges during the InstallUISequence, you're going to run into issues.

For example, a standard user runs the installer and only once they hit the "Install" button (with the UAC shield) are they prompted for Administrative credentials so you don't know if an Administrator is going to provide them or not earlier on in the installation process.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文