Hi,
You can get the OUs as follows
$OUs = Get-ADOrganizationalUnit -Filter * | Where-Object {Get-ADObject -SearchBase $_.DistinguishedName -SearchScope OneLevel -Filter *}|
Where-Object {([array](Get-ADObject -SearchBase $_.DistinguishedName -SearchScope OneLevel -Filter {ObjectClass -ne 'computer'})).count -eq 0}
There is a provider of Active Directory and the Get-Acl cmdlet can get the ACL objects for you.
Set-Location AD:
(Get-Acl -Path $OU.DistinguishedName).Access
This link can be helpful.
https://devblogs.microsoft.com/scripting/use-powershell-to-explore-active-directory-security/
Best Regards,
Ian Xue
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.