LDAP URI for ActiveDirectory

active-directoryldap

I need to create a script that can query users on Active Directory.

Assuming:
All my users are connected to a server called "engineering.software.companyX.com".
All our PC's have domain accounts to the name above.

What LDAP URI do I use?

Best Answer

You may use dsquery to query the AD domain. To get the distinguishedName of the computer myComputer:

dsquery computer -name "myComputer"
  CN=myComputer,CN=Computers,DC=engineering,DC=software,DC=companyX,DC=com

You can also query users by their logon name:

dsquery user -samid "Administrator"
  "CN=Administrator,CN=Users,DC=engineering,DC=software,DC=companyX,DC=com

Edit:

I see from the edits you just want the LDAP connection string/URI. Try this:

ldap://DC=engineering,DC=software,DC=companyX,DC=com