checking dns forwarders of all domain controllers

  • connect to the ldap provider

$dcs = [adsi]LDAP://ou=domain controllers,dc=mydomain,dc=com

  • get a list of all dcs

$dcs = $dcs.psbase.children | select -ExpandProperty name

  • query the dns class
$dcs | % { Write-Output $_ ; (gwmi -Namespace root\microsoftdns -ComputerName $_ -Query "select forwarders from microsoftdns_server").forwarders }

Comments