当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] 用户帐户控制属性值

作者:精品下载站 日期:2024-12-14 20:36:07 浏览:16 分类:玩电脑

用户帐户控制属性值


在本文中,您将了解 Active Directory 中的 UserAccountControl 属性。此外,我创建了一个表,列出了所有 UserAccountControl 属性标志及其说明,您可以搜索和过滤该表。

目录

  • 什么是 UserAccountControl 属性
  • UserAccountControl 属性是累积的(重要)
  • UserAccountControl 属性标志列表
  • 如何查看 UserAccountControl 属性
  • 查找具有特定标志的帐户
  • 如何更改 UserAccountControl 属性

UserAccountControl 属性是什么?

UserAccountControl 是 Active Directory 中用户和计算机对象的属性。此属性代表各种设置和标志,告诉 Windows 要启用哪些用户帐户选项。例如,当帐户被禁用时,该帐户的 UserAccountControl 值将为 514。

您可以使用 UserAccountControl 属性搜索具有特定设置的帐户或更新用户帐户设置。查看此属性时,该值将以十进制或十六进制格式显示。您可以使用下表查看每个值的说明。

UserAccountControl 属性是累积的(重要)

在使用 UserAccountControl 属性时理解这一点非常重要。

UserAccountControl 属性值是累积的,这意味着设置其他帐户属性时该数字将会增加。在搜索具有特定标志的帐户时了解这一点很重要,因为您可能会搜索错误的值。

让我们看一个例子。

创建用户帐户时,其值通常为 512(十六进制为 0x200)。

[玩转系统] 用户帐户控制属性值

当帐户被禁用时,该值更改为 514(十六进制为 0x202)。如果您查找已禁用帐户的 UserAccountControl 值,它将是 0x002(十进制 2)。那么为什么账号会变成514呢?

[玩转系统] 用户帐户控制属性值

为什么值会变成514?

  • 普通用户帐户=512
  • 禁用帐户=2
  • 将这些加在一起,得到 514

非常简单,但在搜索和查看用户帐户的 UserAccountControl 值时了解这一点很重要。

UserAccountControl 属性标志列表

提示#1: UserAccountControl 标志是累积的(见上文)。
提示#2:您无法设置某些值,因为这些值只能由目录服务设置。

Property flagHexadecimal ValueDecimal ValueDescription SCRIPT0x00011The logon script will be run. ACCOUNTDISABLE0x00022The user account is disabled. HOMEDIR_REQUIRED0x00088The home folder is required. LOCKOUT0x001016The account locked PASSWD_NOTREQD0x002032No password is required. PASSWD_CANT_CHANGE0x004064 The user can’t change the password. ENCRYPTED_TEXT_PWD_ALLOWED0x0080128The user can send an encrypted password. TEMP_DUPLICATE_ACCOUNT0x0100256It’s an account for users whose primary account is in another domain. NORMAL_ACCOUNT 0x0200512 It’s a default account type that represents a typical user. INTERDOMAIN_TRUST_ACCOUNT0x08002048It’s a permit to trust an account for a system domain that trusts other domains. WORKSTATION_TRUST_ACCOUNT0x10004096It’s a computer account for a computer that is running Microsoft Windows NT 4.0 Workstation, NT 4.0 Server, 2000 PRO or 2000 server and is a member of this domain. SERVER_TRUST_ACCOUNT0x20008192It’s a computer account for a domain controller that is a member of this domain. DONT_EXPIRE_PASSWORD 0x1000065536Represents the password, which should never expire on the account. MNS_LOGON_ACCOUNT0x20000131072It’s an MNS logon account. SMARTCARD_REQUIRED0x40000262144When this flag is set, it forces the user to log on by using a smart card. TRUSTED_FOR_DELEGATION0x80000524288When this flag is set, the service account (the user or computer account) under which a service runs is trusted for Kerberos delegation. NOT_DELEGATED0x1000001048576When this flag is set, the security context of the user isn’t delegated to a service even if the service account is set as trusted for Kerberos delegation. USE_DES_KEY_ONLY0x2000002097152(Windows 2000/Windows Server 2003) Restrict this principal to use only Data Encryption Standard (DES) encryption types for keys DONT_REQ_PREAUTH0x4000004194304(Windows 2000/Windows Server 2003) This account doesn’t require Kerberos pre-authentication for logging on. PASSWORD_EXPIRED0x800000 8388608(Windows 2000/Windows Server 2003) The user’s password has expired. TRUSTED_TO_AUTH_FOR_DELEGATION0x100000016777216(Windows 2000/Windows Server 2003) The account is enabled for delegation. It’s a security-sensitive setting PARTIAL_SECRETS_ACCOUNT0x0400000067108864(Windows Server 2008/Windows Server 2008 R2) The account is a read-only domain controller (RODC). It’s a security-sensitive setting.

如何查看 UserAccountControl 属性

在本节中,我将向您展示如何使用 Active Directory 和 PowerShell 查看 UserAccountControl 属性。

步骤1.打开ADUC

打开 Active Directory 用户和计算机控制台。

步骤 2. 开设用户帐户

打开任意帐户并单击属性编辑器选项卡。向下滚动到 UserAccountControl 属性。

[玩转系统] 用户帐户控制属性值

在属性编辑器框中,它将显示十六进制值。如果编辑该属性,它将显示十进制值。

[玩转系统] 用户帐户控制属性值

步骤 3. 使用 PowerShell

要使用 PowerShell 获取 UserAccountControl 值,请使用此命令。

get-aduser -identity USERNAME -properties * | select name, useraccountcontrol

[玩转系统] 用户帐户控制属性值

如何查找具有特定 UserAccountControl 标志的帐户

您可以轻松地在 Active Directory 中搜索具有特定 UserAccountControl 标志的帐户。

示例 1. 查找带有 512(正常)标志的帐户

在此示例中,我使用等于 PowerShell 运算符来表示 512 值。

get-aduser -filter * -properties UserAccountControl | where {$_.UserAccountControl -eq 512} | select name, UserAccountControl

[玩转系统] 用户帐户控制属性值

示例2.查找不正常账户

在此示例中,我使用不等于运算符列出所有非 512 的帐户。

get-aduser -filter * -properties UserAccountControl | where {$_.UserAccountControl -ne 512} | select name, UserAccountControl

[玩转系统] 用户帐户控制属性值

示例 3.AD Pro 工具包

AD Pro 工具包包含 200 多个内置报告。只需点击几下鼠标,您就可以快速运行报告。搜索框可让您过滤和搜索报告。

[玩转系统] 用户帐户控制属性值

在下面的屏幕截图中,我搜索设置为“PasswordDoesNotExpire”的任何帐户。您可以看到某些用户的 UAC 十进制数字不同,这是因为帐户启用了多个设置。使用该工具包,您可以搜索所有列,从而轻松找到特定帐户。

[玩转系统] 用户帐户控制属性值

如何更改 UserAccountControl 属性

警告:您不应盲目更改 UserAccountControl 属性。这不是典型任务,只能在特定情况下完成。此外,如果您要对多个帐户执行此操作,则应在 1 或 2 个帐户上进行测试,以确保其具有所需的效果。

您可以通过多种方法更改 UserAccountControl 属性。

  1. 手动使用 ADUC
  2. 电源外壳
  3. AD专业工具包

手动使用 ADUC

使用 ADUC,您可以打开用户帐户并编辑 userAccountControl 属性,然后输入新值。例如这个账户值为514,我将其更改为512。

[玩转系统] 用户帐户控制属性值

在值框中,我将输入 512 并单击“确定”。

[玩转系统] 用户帐户控制属性值

使用 PowerShell 更改 UserAccountControl

您可以使用 set-aduser cmdlet 更改 UserAccountControl 属性。在此示例中,我将值从 514 更改为 512。

set-aduser -identity healther.jay -replace @{useraccountcontrol=512}

还有 set-ADAccountControl cmdlet 可让您修改 UserAccountControl 值。

Set-ADAccountControl -Identity healther.jay -PasswordNotRequired $False

参考

  • UserAccountControl 属性标志
  • 设置 ADAccountControl PowerShell cmdlet

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯