Find name of Active Directory domain controller
Solution 1:
On any computer, that has DNS configured to use AD's DNS server do:
Start -> Run ->
nslookup
set type=all _ldap._tcp.dc._msdcs.DOMAIN_NAME
Replace DOMAIN_NAME with the actual domain name e.g. example.com. Read more here.
Solution 2:
For a computer that is a member of a domain the Environment Variable LOGONSERVER contains the name of the DC that authenticated the current user. This is obviously not going to be all DC's in a multi-DC environment but if all you want is a quick way to find the name of a Domain Controller then from a command shell:
set l <enter>
Will return all Environment variables that start with "L" including the name of a DC.
Solution 3:
An unmentioned, super easy, and quick option is to run this from a command prompt:
nltest /dclist:domainname
Just replace 'domainname' with your domain
You can also run some other options to find out more:
/dcname:domainname
gets the PDC name for the domain
/dsgetdc:domainname
has flags for other information
Try nltest /?
in your prompt to get more options! :)
Solution 4:
This will return your closest Domain Controller in Powershell:
Import-Module ActiveDirectory
(Get-ADDomainController -DomainName <Domain FQDN> -Discover -NextClosestSite).HostName
Solution 5:
From a command prompt, run gpresult
. You will get:
- General workstation and domain information
- For both the computer and the user:
- Distinguished name in AD and which DC the policy was applied from
- Applied Group Policy objects
- List of security groups a member of
Here is example output of running gpresult
. You can also specify gpresult /z
to get more detailed information.