0
我知道这个主题已经在这里讨论过了,但是这里和其他网站上的解决方案似乎不适合我。set-acl到AD OU
我想添加到CNO:创建计算机对象的OU上的“CLUSTER”权限。
更多或更少的所有解决方案都基于以下理念:
$ou = 'OU=sql,OU=prod,DC=ssd,DC=xxx,DC=net'
$cno = 'CLUSTER1'
$sid = [System.Security.Principal.SecurityIdentifier](Get-ADComputer -Filter "name -eq `"$cno`"").SID
$acl = get-acl $ou
$objectGUID = New-Object guid bf967a86-0de6-11d0-a285-00aa003049e2
$guidNull = New-Object guid 00000000-0000-0000-0000-000000000000
$ace1 = new-object System.DirectoryServices.ActiveDirectoryAccessRule $sid,"ReadProperty,GenericExecute","Allow",$guidNull,"None",$guidNull
$acl.AddAccessRule($ace1)
$ace2 = new-object System.DirectoryServices.ActiveDirectoryAccessRule $sid,"CreateChild","Allow",$ObjectGUID,"None",$guidNull
$acl.AddAccessRule($ace2)
set-acl -aclobject $acl $ou
我收到以下错误:
Set-Acl : This security ID may not be assigned as the owner of this object
At line:1 char:8
+ set-acl <<<< -aclobject $acl $ou
+ CategoryInfo : NotSpecified: (OU=sql,OU=ssd...=xxx,DC=net:String) [Set-Acl], ADException
+ FullyQualifiedErrorId : ADProvider:SetSecurityDescriptor:ADError,Microsoft.PowerShell.Commands.SetAclCommand
任何想法可能是错误的?
但在这种情况下,我不能运行$ acl.AddAccessRule($ ACE1) –
另外如何执行最后一行其中$ ACL对象是参数:'设置ACL -aclobject $ ACL $ ou' –
我已经更新ADSI解决方案的答案是我能够测试和确认作品。 – StephenP