How to display all OU’s & their distinguished Name from your domain

Today I wanted a quick overlook of all the OU’s and their distinguished Name. This is how I did that. Open a PowerShell prompt and enter the following :

Get-ADOrganizationalUnit -Filter 'Name -like "*"' | Format-Table Name, DistinguishedName -A

U can expect a reply something like below :

Name                 DistinguishedName
----                 -----------------
Domain Controllers   OU=Domain Controllers,DC=FABRIKAM,DC=COM
UserAccounts         OU=UserAccounts,DC=FABRIKAM,DC=COM
Sales                OU=Sales,OU=UserAccounts,DC=FABRIKAM,DC=COM
Marketing            OU=Marketing,OU=UserAccounts,DC=FABRIKAM,DC=COM
Production           OU=Production,OU=UserAccounts,DC=FABRIKAM,DC=COM
Finance              OU=Finance,OU=UserAccounts,DC=FABRIKAM,DC=COM
Corporate            OU=Corporate,OU=UserAccounts,DC=FABRIKAM,DC=COM

Leave a Reply

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