I use this all the time, and get-adDomainControllers is a broken command, so this quickly grabs the DCs and can get other info if needed.
$AllDCS=[system.directoryservices.activedirectory.Forest]::GetCurrentForest().domains | %{$_.DomainControllers.name}
$AllDCS |
foreach {
Get-ADdomaincontroller $_.trim() | select Hostname, IPv4Address
}
NETDC02.nsw.gov.au 20.48.31.116
NETDC04.nsw.gov.au 20.48.31.117
1 comment:
Great reading youur post
Post a Comment