I have to check and then potentially update up to 400 zone nameserver records.

I thought I could turn to Powershell to do this in far less time, and eliminate any mistakes that would no doubt happen doing this manually. However the PS command I understand outputs Name Servers of a zone, is producing a list of more servers than is showing in the GUI (See images below).

On the thought that it was getting this list from all known name servers in the domain, I checked, and even this larger list is still missing 2, so I am at a loss as to where this list is coming from. Anyone know?

Curiosity aside, I need a cmdlet to output only the name servers in the zone I specify. If not this cmdlet, which one?

GUI query

Command Line query

  • use the -ComputerName specification to ensure you are only querying the single DNS server rather than every DNS server hosting the forward lookup zone.
    – Citizen
    Apr 24, 2020 at 0:38
  • @Citizen - docs.microsoft.com/en-us/powershell/module/dnsserver/… doesn't suggest that ommiting the -ComputerName <DNS server> parameter would query all DNS servers. Specifically it says "If you do not specify this parameter, the command runs on the local system.". I will of course test this later today and report back either way.
    – user66001
    Apr 24, 2020 at 9:05
  • I remember having an issue similar to yours about 6 months ago, I thought that I shared the fix. Interested to know if I steered you in the correct direction. Hope I gave you solid info.
    – Citizen
    Apr 24, 2020 at 18:37
  • 1
    The command and arguments you're supplying all seem correct (At least in my testing). If the GUI doesn't match the results in your console, there is a good chance that you need to refresh (Right click on your "Test" zone -> Refresh) the GUI on. The DNS Manager and the DNS snap-in both don't automatically refresh sadly.
    – HiTech
    Sep 8, 2021 at 21:59
  • @Citizen - Where was the fix shared?
    – user66001
    Oct 29, 2021 at 17:09


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy