Active Directory OU Report

Active Directory organizes its objects in different containers. These containers are called organizational units or OU. As an environment grows it is important to keep a report of all your OU information. Here are some helpful scripts for OU reporting.

Script to get all OU and their information

[sourcecode language=”css”]

Get-ADOrganizationalUnit -Filter * -Properties * | ConvertTo-Csv | Out-File c:scriptsOUReport.csv


Script to Detect OUs that are not protected from Accidential Deletion

[sourcecode language=”css”]

Get-ADOrganizationalUnit -Filter * -Properties ProtectedFromAccidentalDeletion | where {$_.ProtectedFromAccidentalDeletion -eq $false} | Select Name, DistinguishedName


Script to protect all OUs from accidential deletion

[sourcecode language=”css”]

Get-ADOrganizationalUnit -filter * -Properties ProtectedFromAccidentalDeletion | where {$_.ProtectedFromAccidentalDeletion -eq $false} | Set-ADOrganizationalUnit -ProtectedFromAccidentalDeletion $true


Microsoft Links


Subscribe For Latest Updates

Sign up for best of digital marketing, livestream and technology opinions on what matters to you.

Invalid email address
We promise not to spam you. You can unsubscribe at any time.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: