Hi,
I want to delegate the task "Move Object" in Active Directory. As far as I found in the Internet I need
- delete object
- create object
- write CN, DN and RDN
I'm using
$aceAccessControlType = 'Allow'
$aceActiveDirectoryRights = @('CreateChild', 'Delete')
$aceInheritanceType = 'All'
$aceObject.AddAccessRule((New-Object System.DirectoryServices.ActiveDirectoryAccessRule $delegateObjectSid,$aceActiveDirectoryRights,$aceAccessControlType,$objectType,$aceInheritanceType,$inheritedObjectType))
to create the permissions on the OU:
Get-ACL AD:\'OU=Test OU Helmut,OU=IT,DC=domain,DC=local' | select -ExpandProperty Access | where { $PSItem.IdentityReference -eq 'DOMAIN\Move Computer Objects' }
ActiveDirectoryRights : CreateChild, Delete
InheritanceType : Descendents
ObjectType : 00000000-0000-0000-0000-000000000000
InheritedObjectType : bf967a86-0de6-11d0-a285-00aa003049e2
ObjectFlags : InheritedObjectAceTypePresent
AccessControlType : Allow
IdentityReference : DOMAIN\Move Computer Objects
IsInherited : True
InheritanceFlags : ContainerInherit
PropagationFlags : InheritOnly
[...]
I am able to create objects in the OU but not in sub OUs. If I delegate using the GUI the Properties look slightly different:
ActiveDirectoryRights : CreateChild, DeleteChild
InheritanceType : All
ObjectType : bf967a86-0de6-11d0-a285-00aa003049e2
InheritedObjectType : 00000000-0000-0000-0000-000000000000
ObjectFlags : ObjectAceTypePresent
AccessControlType : Allow
IdentityReference : DOMAIN\Move Computer Objects
IsInherited : True
InheritanceFlags : ContainerInherit
PropagationFlags : None
ObjectFlags and PropagationFlags differ and even though I set "InheritanceType = All'" it results in "Descendants".
I found https://learn.microsoft.com/en-us/dotnet/api/system.security.accesscontrol.objectaccessrule which has an construtor for both but I cannot create it:
New-Object : A constructor was not found. Cannot find an appropriate constructor for type System.Security.AccessControl.ObjectAccessRule
What am I doing wrong, how can I set PropagationFlags and ObjectFlags? Do I at all?
Thank you!