O R G A N I C / F E R T I L I Z E R: checking dns forwarders of all domain controllers

Jun 12, 2012

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 }