Active Directory (finding LDAP information)

While trying to find how to connect a J2EE server with active directory I came to realize how little information I had on the domain controller, as I am no Domain administrator nor I have admin access on any machine, trying to figure out this information was just not doable, unless I installed a tool… or so I thought.

Here comes internet to the rescue, and here it is:
1) find out your domain, a simple IPCONFIG /ALL is what we need.
from there the Connection-specific DNS Suffix . will provide that information.
2) Next we need to identify who is our LDAP preferred server.
so we go to nslookup in a command prompt window to query that information.
in nslookup we set:

set type=all
> _ldap._tcp.dc._msdcs.[place domain name here from DNS Suffix]
and bam! you have the port used and the LDAP collection of servers you can use.

Sample output:
on-authoritative answer:
ldap._tcp.dc._msdcs.XXXXX.ad.XXXX.com SRV service location:
priority = 0
weight = 100
port = 389
svr hostname = XXservernameXX.XXX.ad.XXdomainXX.com
ldap._tcp.dc._msdcs..XXXXX.ad.XXXX.com SRV service location:
priority = 0
weight = 100
port = 389
svr hostname = XXservernameXX.XXX.ad.XXdomainXX.com
ldap._tcp.dc._msdcs..XXXXX.ad.XXXX.com SRV service location:
priority = 0
weight = 100
port = 389
svr hostname = XXservernameXX.XXX.ad.XXdomainXX.com

references:

  • StackOverflow post