So I’m playing around with a script to transfer a zone from another DNS server to my own DNS servers. I’m using DnsShell for most of my operation’s ( it has a few bugs, but nothing that cant be handled by adding abit of WMI ) but I couldn’t get AXFR requests to work. google sendt me to PowerShell Dig PoshNet but that didn’t work either, and then it hit me (I can be so slow sometimes), I can’t AXFR from my default DNS server I need to ask hosting DNS server, and no need to bother with different PSSnapins. DnsShell does the work just fine. Here is an example.
$zonename = ‘somedomain.com’
$nameservers = (Get-Dns $zonename ns) | Select-Object -ExpandProperty Answer
$dnsserver = (get-dns $nameservers.RecordData).Answer.RecordData
Write-Host (‘Asking ‘ + $nameservers.RecordData + ' ' + $dnsserver)
$zone = Get-Dns -Name $zonename -RecordType axfr -Server $dnsserver | Select-Object -ExpandProperty Answer