【发布时间】:2014-11-22 13:13:55
【问题描述】:
有谁知道如何针对 AD 用户的属性生成 ACL 报告。 例如,谁有权对 Active Directory 用户“读取姓名缩写”或“写入姓名缩写”属性。 我发现 PowerShell 命令可以在 AD 用户对象本身上获取 ACL,但不是在属性级别。
【问题讨论】:
标签: powershell
有谁知道如何针对 AD 用户的属性生成 ACL 报告。 例如,谁有权对 Active Directory 用户“读取姓名缩写”或“写入姓名缩写”属性。 我发现 PowerShell 命令可以在 AD 用户对象本身上获取 ACL,但不是在属性级别。
【问题讨论】:
标签: powershell
查看PowerShell Access Control module。版本 3.0 几乎完全在 PowerShell 中实现,这使得它与使用 Get-Acl 相比相当慢,但我认为它可以满足您的要求(我正在处理速度问题)。
它有一个名为 Get-EffectiveAccess 的函数,可以计算主体对安全对象的有效访问,但我认为这不是您要寻找的。听起来您想获取提供对“initials”属性的读/写访问权限的 ACE 列表。为此,您将使用 Get-AccessControlEntry:
# Get any ACEs that grant or deny read or write access to the 'initials' property:
Get-ADUser TestUser | Get-AccessControlEntry -ObjectAceType initials
# Get any ACEs that grant or deny write access to the 'initials' property:
Get-ADUser TestUser | Get-AccessControlEntry -ObjectAceType initials -ActiveDirectoryRights WriteProperty
# Get any ACEs that grant write access to the 'initials' property:
Get-ADUser TestUser | Get-AccessControlEntry -ObjectAceType initials -ActiveDirectoryRights WriteProperty -AceType AccessAllowed
这些示例都使用 Get-ADUser 来查找单个用户。您应该能够为函数提供任何 AD 对象,无论您使用 AD 模块还是 DirectorySearcher。您甚至可以提供可分辨名称作为函数的 -Path 参数。
-ObjectAceType 参数应该能够采用 GUID,或者您可以放入一个或多个属性/属性集/验证写入/扩展权限/类对象名称(您可以使用 * 作为通配符)。
如果您确实想计算实际的有效访问,以下是 Get-EffectiveAccess 函数的一些示例:
# Get effective access that 'AnotherUser' has over 'TestUser' object (this doesn't include property, property set, validated write, etc effective permissions):
Get-ADUser TestUser | Get-EffectiveAccess -Principal AnotherUser
# Same as before, but this time include effective access down to the ObjectAceType level:
Get-ADUser TestUser | Get-EffectiveAccess -Principal AnotherUser -ObjectAceTypes initials
Get-ADUser TestUser | Get-EffectiveAccess -Principal AnotherUser -ObjectAceTypes init*
在处理最后几个示例时,我注意到在使用带有 -ObjectAceTypes 参数的 Get-EffectiveAccess 时会出现一些错误,即使该函数似乎可以正常工作。如果我周末有时间,我可能会解决这个问题,但我可能会等待 4.0 版。
【讨论】: