这当然是可能的,但我不知道有现成的解决方案可以满足您的需求。您需要自己解决每个 ACE 的单独访问权限。像这样的东西应该工作:
$dn = 'OU=ParentOU,OU=ChildOU,DC=test,DC=test,DC=com'
$ADS_RIGHTS_ENUM = @{
'ADS_RIGHT_DELETE' = 0x10000
'ADS_RIGHT_READ_CONTROL' = 0x20000
'ADS_RIGHT_WRITE_DAC' = 0x40000
'ADS_RIGHT_WRITE_OWNER' = 0x80000
'ADS_RIGHT_SYNCHRONIZE' = 0x100000
'ADS_RIGHT_ACCESS_SYSTEM_SECURITY' = 0x1000000
'ADS_RIGHT_GENERIC_READ' = 0x80000000
'ADS_RIGHT_GENERIC_WRITE' = 0x40000000
'ADS_RIGHT_GENERIC_EXECUTE' = 0x20000000
'ADS_RIGHT_GENERIC_ALL' = 0x10000000
'ADS_RIGHT_DS_CREATE_CHILD' = 0x1
'ADS_RIGHT_DS_DELETE_CHILD' = 0x2
'ADS_RIGHT_ACTRL_DS_LIST' = 0x4
'ADS_RIGHT_DS_SELF' = 0x8
'ADS_RIGHT_DS_READ_PROP' = 0x10
'ADS_RIGHT_DS_WRITE_PROP' = 0x20
'ADS_RIGHT_DS_DELETE_TREE' = 0x40
'ADS_RIGHT_DS_LIST_OBJECT' = 0x80
'ADS_RIGHT_DS_CONTROL_ACCESS' = 0x100
}
Import-Module ActiveDirectory
$acl = Get-Acl "AD:$dn"
foreach ($ace in $acl.Access) {
$ADS_RIGHTS_ENUM.Keys | Where-Object {
$ace.ActiveDirectoryRights.value__ -band $ADS_RIGHTS_ENUM[$_]
} | ForEach-Object {
"{0}`t{1}`t{2}" -f $ace.IdentityReference, $_, $ace.AccessControlType
}
}