【问题标题】:Get the permissions of an Active Directory schema object获取 Active Directory 架构对象的权限
【发布时间】:2021-11-22 17:37:03
【问题描述】:
  • PS 版本:PowerShell 7+
  • 操作系统版本:Windows Server 2016

目标:我想使用 PowerShell 来获取 AD 架构对象的权限,而不需要 Active Directory PsDrive / PsProvider。

根据我的测试,AD 模块附带的 Active Directory PsProvider 不适用于 Windows Server 2016 上的 PowerShell 7+。 This MS documentation 也提到了这一点。因为创建/使用 Active Directory PsDrive 需要 PsProvider,所以您无法访问像 AD:\ 这样的 AD 对象。使用这种方法通常是我喜欢的。下面是我所需要的一个示例,除了我使用的是 Windows PowerShell 而不是 PowerShell 7+。

这将获取配置架构权限:

(Get-Acl "AD:$((Get-ADRootDSE).schemaNamingContext)").Access

该对象的可分辨名称示例:

CN=Schema,CN=Configuration,DC=my,DC=domain,DC=com

鉴于上述限制,我可以使用 PowerShell 7+ 中的哪些其他选项来访问这些权限?

【问题讨论】:

    标签: powershell active-directory


    【解决方案1】:

    • 根据您在 Windows Server 2016 中的 powershell 上运行的命令,它会显示相关域的活动目录架构权限。但是,如下图所示,在我安装了 Powershell 7.0+ 的环境中运行此命令时,我得到了与普通 powershell 相同的适当输出。

    • 虽然您可以使用以下查询更改与架构对象相关的权限:-

    为右侧“读写所有属性/此对象和所有后代”添加ACL规则-

     $rootdse = Get-ADRootDSE
     $extendedrightsmap = @{}
     Get-ADObject -SearchBase ($rootdse.ConfigurationNamingContext) -LDAPFilter `
     "(&(objectclass=controlAccessRight)(rightsguid=*))" -Properties 
      displayName,rightsGuid | 
     % {$extendedrightsmap[$_.displayName]=[System.GUID]$_.rightsGuid}
     $extendedrightsmap
    

    更多信息请点击以下链接:-

    https://social.technet.microsoft.com/wiki/contents/articles/51121.active-directory-schema-update-and-custom-attribute.aspx

    【讨论】:

    • 您使用的是 Windows 10 计算机。根据我提供的链接,只要您安装了 RSAT,Windows Server 1809+(Windows Server 2019)和 Windows 10 1809+ 上的 PowerShell 7+ 完全支持 ActiveDirectory 模块。
    • 查看您的初始代码后,您的示例似乎没有得到我正在寻找的信息。我正在寻找获得此对象"AD:$((Get-ADRootDSE).schemaNamingContext)" 的权限。如果我在这里没有使用正确的术语,我需要在我的 OP 中提供的命令的等效输出。这与需要从 Get-Acl 返回完全相同的对象类型相混淆。也许“访问”在这里是正确的术语。
    • 为了通知您,我发布了上面来自 Windows Server 2019 Datacenter 版 VM 的屏幕截图。已在其外部安装了 Powershell 7.0+,添加了 AD 和 DNS 的角色,然后运行显示该特定 AD 容器权限的命令。为确保这一点,您可以通过 GUI 模式在 ADSI.edit 中进行检查。
    • 感谢您更新我的环境规格。根据我提供的链接,您的测试环境在兼容性列表中。这就解释了为什么你能够得到你得到的结果。正如我最初提到的,我遇到的问题发生在不在兼容性列表中的 Windows Server 2016 上。
    • 如果回答对您有帮助,请Accept it as an Answer and Upvote it,以便遇到相同问题的其他人可以找到此解决方案并解决他们的问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-04-14
    • 1970-01-01
    • 2017-11-26
    • 2023-01-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多