Get DNS forwarder from forest

#Domain names in forest

$ForestInfo = Get-ADForest
$Domains =$forestInfo.domains
$FileName = “DNSForwarder”+”$(get-date -Format MM-dd-yyyy)”+”.csv”
$FilePath = “c:\temp”
foreach($domain in $domains){
Write-Output “Working on $domain”
get-dnsserverforwarder -computer $domain| select IPAddress, @{l=”Domain”;e={$domain}}| Export-Csv -NoTypeInformation $FilePath\$FileName -append
}

1 Comment

  1. Pretty section of content. I just stumbled upon your site and in accession capital to assert that I acquire in fact enjoyed account your blog posts. Anyway I’ll be subscribing to your feeds and even I achievement you access consistently quickly.

Leave a Reply

Your email address will not be published.