Find LDAP DN of Users and Groups using the Command Line
I always forget this command, so here's a handy reference (for moi):
| Find LDAP Path of... | Command |
|---|---|
| OU | dsquery OU -name "OU name" |
| Group | dsquery group -name "Group name" |
| Username | dsquery user -name username |
| Computer | dsquery computer -name computername |
Note (2025): dsquery is typically available on domain controllers or with RSAT/AD DS tools installed. On newer systems, you can also use the PowerShell ActiveDirectory module (e.g., Get-ADUser, Get-ADGroup) for similar lookups. The dsquery commands above remain valid.
Fun!