Get the ACL of OUs with servers only inside

Sylvain MALAGRE 21 Reputation points
2021-01-15T10:25:06.523+00:00

Hi Guys,

I have to get the ACLs of all my OUs where servers only are inside and check if the inheritance is disabled or not.

Can you help me please ?

Thank you.

Cheers,

Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
6,645 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,553 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ian Xue 37,706 Reputation points Microsoft Vendor
    2021-01-18T09:24:49.517+00:00

    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.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.