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
OUdsquery OU -name "OU name"
Groupdsquery group -name "Group name"
Usernamedsquery user -name username
Computerdsquery 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!