Get OU Distinguished Name

Active Directory Logo
Active Directory Logo

Estimated reading time: 2 minutes

There are many reasons as to why you would need to identify an Active Directory Organisational Unit’s Distinguished Name.

Most techies out there will use an AD distinguished name when writing or using PowerShell scripts.

However, quickly finding what the Distinguished name of a particular OU is not immediately clear. You can click on the object tab for information, but not the distinguished name.

Using PowerShell to get the Distinguished Name

The simple solution on how to quickly find an OU’s distinguished name is to use PowerShell itself.

The information you will need first is:

  • OU Name
  • AD Integration for PowerShell

That’s it – once you have this, you can go ahead and run the below PowerShell script:

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

The only part you need to change in this PowerShell script is the * wildcard. If you leave it as a wildcard, it will bring back the distinguished name for all of your OU’s.

To bring back just one particular OU distinguished name, then change this * wildcard to the name of your OU.

Comments

If you have any problems with getting this working or if you just want to leave us a thanks – feel free to leave us a message below in the comments box.

Newsletter

If you want to be notified when we post more quality guides like this one, sign up to our newsletter and you will receive an email when a new post is live.

[jetpack_subscription_form show_only_email_and_button=”true” custom_background_button_color=”undefined” custom_text_button_color=”undefined” submit_button_text=”Subscribe” submit_button_classes=”undefined” show_subscribers_total=”true” ]

Don’t worry, we won’t be filling your inbox with spam and you can unsubscribe anytime you like.

Share this content:

Click to rate this post!
[Total: 0 Average: 0]
Avatar for Andrew Armstrong

About Andrew Armstrong

Founder of TechyGeeksHome and Head Editor for over 15 years! IT expert in multiple areas for over 26 years. Sharing experience and knowledge whenever possible! Making IT Happen.

View all posts by Andrew Armstrong

Leave a Reply

Your email address will not be published. Required fields are marked *