I have manually set some custom DACL on some AD-LDS objects using LDP. I am trying to write a script that exports those ACL (only DACL for now) in SDDL form.
I can retrieve a AD-LDS object with this code:
$obj = Get-ADOrganizationalUnit -Filter {Name -Like 'stuff'} -searchbase "OU=apps,DC=example,DC=com" -server 'localhost:389'
$obj[0].distinguishedName
OU=stuff,OU=apps,DC=example,DC=com
I am aware of the the get-acl Powershell command and its Active Directory aware syntax, but when I try it on my AD-LDS object, it fails with
Get-Acl : Cannot find path 'OU=stuff,OU=apps,DC=example,DC=com' because
it does not exist.
At line:1 char:9
+ (Get-Acl <<<< "DC=example,DC=com").access
+ CategoryInfo : ObjectNotFound: (:) [Get-Acl], ItemNotFoundException
+ FullyQualifiedErrorId : GetAcl_PathNotFound_Exception,Microsoft.PowerShell.Commands.GetAclCommand
I tried to prefix the get-acl command with the AD:
prefix, as well as ldap://localhost/
, but the error stays the same. I also failed to retreive the DACL of other types of objects (like user
and group
).
How can I use Powershell to retrieve the DACL of a AD-LDS object in SDDL form?