Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
powershell ACL复制目录更改权限_Powershell_Acl - Fatal编程技术网

powershell ACL复制目录更改权限

powershell ACL复制目录更改权限,powershell,acl,Powershell,Acl,目的:获取在AD中具有复制目录更改权限的用户列表 我一直在尝试此powershell命令,并获得以下输出: Get-ObjectACL -DistinguishedName "dc=hendel,dc=local" -Domain hendel.local -ResolveGUIDs | ? {($_.ObjectType -match 'replication-get') -or ($_.ActiveDirectoryRights -match 'GenericA

目的:获取在AD中具有复制目录更改权限的用户列表

我一直在尝试此powershell命令,并获得以下输出:

Get-ObjectACL -DistinguishedName "dc=hendel,dc=local" -Domain hendel.local -ResolveGUIDs | 
? {($_.ObjectType -match 'replication-get') -or 
   ($_.ActiveDirectoryRights -match 'GenericAll')}                                                                                                                                                                           
    
    AceType               : AccessAllowed
    ObjectDN              : DC=hendel,DC=local
    ActiveDirectoryRights : GenericAll
    OpaqueLength          : 0
    ObjectSID             : S-1-5-21-2327505349-568064809-1496836491
    InheritanceFlags      : ContainerInherit
    BinaryLength          : 36
    IsInherited           : False
    IsCallback            : False
    PropagationFlags      : None
    SecurityIdentifier    : S-1-5-21-2327505349-568064809-1496836491-519
    AccessMask            : 983551
    AuditFlags            : None
    AceFlags              : ContainerInherit
    AceQualifier          : AccessAllowed
    
    AceType               : AccessAllowed
    ObjectDN              : DC=hendel,DC=local
    ActiveDirectoryRights : GenericAll
    OpaqueLength          : 0
    ObjectSID             : S-1-5-21-2327505349-568064809-1496836491
    InheritanceFlags      : None
    BinaryLength          : 20
    IsInherited           : False
    IsCallback            : False
    PropagationFlags      : None
    SecurityIdentifier    : S-1-5-18
    AccessMask            : 983551
    AuditFlags            : None
    AceFlags              : None
    AceQualifier          : AccessAllowed
实际上我得到的是ObjectSID…但是显示它相关的samaccountname呢

还有,有没有更好的方法获得同样的结果


谢谢

因为SID可以表示用户、组或计算机,所以我想我应该使用
Get-ADObject
来实现这一点

Get-ObjectACL -DistinguishedName "dc=hendel,dc=local" -Domain hendel.local -ResolveGUIDs | 
    Where-Object {($_.ObjectType -match 'replication-get') -or 
                  ($_.ActiveDirectoryRights -match 'GenericAll')} |
    Select-Object *, @{Name = 'SamAccountName'; Expression = {(Get-ADObject -Filter "objectSid -eq '$($_.ObjectSID)'" -Properties SamAccountName -ErrorAction SilentlyContinue).SamAccountName}}
如果您还想查看对象类和名称,请使用ForEach对象循环。比如:

Get-ObjectACL -DistinguishedName "dc=hendel,dc=local" -Domain hendel.local -ResolveGUIDs | 
    Where-Object {($_.ObjectType -match 'replication-get') -or 
                  ($_.ActiveDirectoryRights -match 'GenericAll')} |
    ForEach-Object {
        $adobj = Get-ADObject -Filter "objectSid -eq '$($_.ObjectSID)'" -Properties SamAccountName,DisplayName,ObjectSid -ErrorAction SilentlyContinue
        $_ | Select-Object *, @{Name = 'SamAccountName'; Expression = {$adobj.SamAccountName}},
                              @{Name = 'DisplayName'; Expression = {$adobj.DisplayName}},
                              @{Name = 'ObjectClass'; Expression = {$adobj.ObjectClass}}
    }

由于SID可以表示用户、组或计算机,因此我想我应该使用
getadobject
来实现这一点

Get-ObjectACL -DistinguishedName "dc=hendel,dc=local" -Domain hendel.local -ResolveGUIDs | 
    Where-Object {($_.ObjectType -match 'replication-get') -or 
                  ($_.ActiveDirectoryRights -match 'GenericAll')} |
    Select-Object *, @{Name = 'SamAccountName'; Expression = {(Get-ADObject -Filter "objectSid -eq '$($_.ObjectSID)'" -Properties SamAccountName -ErrorAction SilentlyContinue).SamAccountName}}
如果您还想查看对象类和名称,请使用ForEach对象循环。比如:

Get-ObjectACL -DistinguishedName "dc=hendel,dc=local" -Domain hendel.local -ResolveGUIDs | 
    Where-Object {($_.ObjectType -match 'replication-get') -or 
                  ($_.ActiveDirectoryRights -match 'GenericAll')} |
    ForEach-Object {
        $adobj = Get-ADObject -Filter "objectSid -eq '$($_.ObjectSID)'" -Properties SamAccountName,DisplayName,ObjectSid -ErrorAction SilentlyContinue
        $_ | Select-Object *, @{Name = 'SamAccountName'; Expression = {$adobj.SamAccountName}},
                              @{Name = 'DisplayName'; Expression = {$adobj.DisplayName}},
                              @{Name = 'ObjectClass'; Expression = {$adobj.ObjectClass}}
    }

您希望它是什么类型的对象?谢谢您的回复..就像这里提供的一样。。。或者至少获得samaccountname,而不是SID,这对您来说还是很陌生的,所以您可能不知道这一点,但通常通过单击✓ 左边的图标。这将帮助其他有类似问题的人更容易找到它,并有助于激励人们回答您的问题。您希望它是什么类型的对象?谢谢您的回答..就像这里提供的一样。。。或者至少获得samaccountname,而不是SID,这对您来说还是很陌生的,所以您可能不知道这一点,但通常通过单击✓ 左边的图标。这将帮助其他有类似问题的人更容易找到它,并有助于激励人们回答你的问题。