Needed to check an OU structure to see if they have the good old “Include inheritable permissions from this object’s parent” checked.
So knocked this up:
$RootOU = [ADSI]”LDAP://:389/Full DN of OU”
$ChildOUs = $RootOU.psbase.Children
ForEach ($xOU in $ChildOUs){
Write-Host $xOU.distinguishedName -Foregroundcolor Red -NoNewLine Write-Host ” : ” -NoNewLine $xOU.psbase.ObjectSecurity.AreAccessRulesProtected
}