I have read through a listing of all the DNS powershell cmdlets and can't believe I didn't find a programmatic way of reading the below list. Am I missing it, or is there a .NET way to do so that I didn't also find?
Powershell – List the name servers in the DNS Zone properties GUI with Powershell
dns-zonepowershell
Best Answer
Get-DnsServerResourceRecord -ComputerName <DNS Server You Are Querying> -ZoneName <Forward Lookup Zone Name> -RRType NS
The name serves type in the properties of the domain you are looking at are populated in the forward lookup zone as NS name records. Those are the name servers for that domain. Querying for the NS resource record in the PS command above will give you those records. To change them, you would use the
Set-DnsServerResourceRecord
cmdlet.The DNS Server cmdlets are located in the DNSServer powershell module.
You can import that commandlet with
Import-Module -Name DNSServer
cmd.You can look at all the commands associated with that module by typing
get-command -Module DNSServer
command.