Wuick Script:
# This function runs faster than the "Get-ADDomainController -Filter *" method
function listControllers{
$domain = [directoryServices.ActiveDirectory.Domain]::GetCurrentDomain().Name
$dcList=(nltest /dclist:$domain)
$dcList = $dcList[1..($dcList.Length-2)] -replace ".$domain*.*" -replace ".* "
return $dcList
}
listControllers
Output:
Get list of DCs in domain 'kimconnect.com' from '\\dc1.kimconnect.com'.
dc1.KimConnect.com [PDC] [DS] Site: KimConnect
dc2.KimConnect.com [DS] Site: KimConnect
dc001.KimConnect.com [DS] Site: KimConnect
DC002.KimConnect.com [DS] Site: KimConnect
DC003.KimConnect.com [DS] Site: KimConnect
LPVADDC004.KimConnect.com [DS] Site: KimConnectLV
dc005.KimConnect.com [DS] Site: KimConnectLV
DC006.KimConnect.com [RODC] [DS] Site: WebDMZ
DC007.KimConnect.com [RODC] [DS] Site: KimConnect-PublicDMZ
DC008.KimConnect.com [RODC] [DS] Site: WebDMZ
DC009.KimConnect.com [RODC] [DS] Site: KimConnect-PublicDMZ
DC010.KimConnect.com [RODC] [DS] Site: KimConnectLV-PublicDMZ
DC011.KimConnect.com [RODC] [DS] Site: KimConnectLV-WebDMZ
DC012.KimConnect.com [RODC] [DS] Site: KimConnectLV-WebDMZ
The command completed successfully
Categories: