Adding name servers to multiple DNS zones with PowerShell

Add multiple DNS servers as name servers to multiple DNS zones all in once. So this is essentially adding NS resource records to a zone, but doing it for multiple zones all at once. So, here’s a quick one-liner that does the trick, obviously substitute in your DNS server and name server FQDNs in the correct places. If it fails for any reason it will continue on, but report the zone it failed on.

 

Get-DnsServerZone -ComputerName dnsserver.vmwareenterprise.com | where {$_.zonetype -eq “primary” -or $_.zonetype -eq “secondary”} | ForEach-Object {try {Add-DnsServerResourceRecord -ZoneName $_.zonename -ns -ComputerName dnsserver.domain.com -name $_.zonename -NameServer newdnsserver.vmeareenterprise.com -ea:stop} catch {“$_”}}

31 Comments

  1. After study a number of of the blog posts on your web site now, and I actually like your manner of blogging. I bookmarked it to my bookmark website list and will probably be checking back soon. Pls try my website online as properly and let me know what you think.

  2. Thanks for sharing superb informations. Your web site is so cool. I am impressed by the details that you’ve on this blog. It reveals how nicely you understand this subject. Bookmarked this web page, will come back for more articles. You, my friend, ROCK! I found simply the info I already searched all over the place and just could not come across. What a perfect website.

  3. I?¦ve been exploring for a little for any high-quality articles or weblog posts on this sort of space . Exploring in Yahoo I at last stumbled upon this web site. Reading this information So i?¦m satisfied to exhibit that I’ve an incredibly excellent uncanny feeling I found out exactly what I needed. I such a lot no doubt will make certain to don?¦t fail to remember this web site and provides it a glance regularly.

  4. You actually make it seem really easy along with your presentation but I to find this matter to be really one thing that I think I might never understand. It seems too complex and very vast for me. I’m having a look forward to your next post, I will attempt to get the dangle of it!

Leave a Reply

Your email address will not be published.