This post explains how to restrict automatic NS resource record registration in Windows Server DNS using Dnscmd. This prevents Windows Server DNS from automatically creating NS records for zones that it hosts on the server.
Run Dnscmd /config /DisableNSRecordsAutoCreation 1 to stop a Windows Server DNS server from creating NS records for its authoritative zones. Be aware: existing NS records for those zones on the server are deleted automatically. Set it back to 0 to restore the default behavior.
What does DisableNSRecordsAutoCreation do?
This registry setting restricts the DNS server from creating name server resource records (NS records) automatically while loading its DNS zones. By default, the name server automates the creation of name server resource records upon loading its zones.
If the registry value is set to 1, the DNS server is restricted from registering NS resource records for authoritative zones. Also, existing name server (NS) records for the authoritative zones that are located on the DNS server are deleted automatically.
Enable DisableNSRecordsAutoCreation with Dnscmd
To enable DisableNSRecordsAutoCreation on the command prompt, use the following command:
Dnscmd /config /DisableNSRecordsAutoCreation 1
Enabling this DisableNSRecordsAutoCreation setting disables the automatic creation of NS records for all zones the DNS server hosts, not just for one zone.
When you just want to know the current status of the setting, run:
Dnscmd /info /DisableNSRecordsAutoCreation
And you can always disable it again: Dnscmd /config /DisableNSRecordsAutoCreation 0
All Dnscmd options are documented on Microsoft Learn: dnscmd.
Working on the DNS client side instead? Here is how to use WMI and netsh to add DNS servers on network adapters.