PowerShell lookup domain controller
A simple script is written, which is suitable for use when you don't know which domain controllers are available, or in a large environment, it is not suitable to write the DC name to death.
Function Find-DomainController
{
Param
(
$Domain = ([System.DirectoryServices.ActiveDirectory.Domain]:: GetCurrentDomain ()) .Name
)
Name = $(New-Object DirectoryServices.Activedirectory.DirectoryContext ("Domain", $Domain))
[System.DirectoryServices.ActiveDirectory.DomainController]:: FindAll ($Name)
}
Find-DomainController
Simply open PowerShell on the domain member and execute it to output all the domain controller lists