• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 8375
  • Last Modified:

Script to add primary dns suffix

I want to write a script or batch file to add or change the primary dns suffix for WINXP and W2K machines.  Using netsh I can force registration of the primary dns suffix, but I don't know how to change the suffix with out manually doing so.  Any help would be greatly appreciated.
0
InsightMedia
Asked:
InsightMedia
  • 4
  • 3
  • 2
1 Solution
 
TheCleanerCommented:
Any reason for not doing it through DHCP or even group policy?
0
 
NJComputerNetworksCommented:
0
 
InsightMediaAuthor Commented:
I want to modify the primary suffix.  I don't care about the suffix search list & I don't want a connection-specific suffix.  I inherited an NT4 domain (using WINS only) when I came here last August.  I will be transitioning from NT domain to 2003 AD in early July.  I am moving over 100 clients (around the state)from static addresses to DHCP,  but DDNS will not properly register the client without adding the domain suffix manually (My computer -> properties -> Computer Name -> change -> more).

I know that when I move to active directory, the suffix will be changed automatically making the FQDN <hostname>.<primary dns suffix>, but I need DNS to work now.    
0
Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

 
NJComputerNetworksCommented:
"I want to modify the primary suffix.  I don't care about the suffix search list & I don't want a connection-specific suffix.  I inherited an NT4 domain (using WINS only) when I came here last August.  "  So, just add one entry...  Don't add more then one entry...

Check out this registry key...You can just add one entry here... you don't need to add  a bunch...

Note Another method is to use Microsoft Windows Script Host: 1. Create a file with the .vbs extension (for example, C:\add.vbs).
2. Add the following two lines to the file:

SET WSHShell = CreateObject("WScript.Shell")
WSHShell.RegWrite "HKLM\System\CurrentControlSet\Services\TCPIP\Parameters\SearchList", "testadatum.com,test2adatum.net,test3adatum.gov", "REG_SZ"

(the second line starts with "WSHShell.RegWrite" and ends with "REG_SZ")
3. Double-click the file to run or at a command prompt, type C:\add.vbs

0
 
TheCleanerCommented:
Set the Domain primary suffix using DHCP (using option 015 DNS domain name), then set the options in DHCP server to ALWAYS update DNS, and to update for clients that do not request updates.

Then DNS will be updated correctly with the A records and PTR records in the proper zones.
0
 
NJComputerNetworksCommented:
HKLM\System\CurrentControlSet\Services\TCPIP\Parameters\NV Domain   <--  This is the registry key for the Primary DNS Setting...

0
 
InsightMediaAuthor Commented:
Cleaner...

I've already done this.  All the DHCP machines show up in my reverse lookup zone but not the forward lookup zone.  They only show up in the forward lookup zone after I manually set the Primary DNS suffix manually, then no problem.  

NJ...This seemed to work on a couple of test machines.  I'll whip up a script & push it out.  Thanks!
0
 
NJComputerNetworksCommented:
np
0
 
TheCleanerCommented:
hmm...strange.  The option should work to set the DNS primary suffix, and setting the DHCP server to "Always update DNS records" should make the DHCP server update the DNS server with A and PTR records anytime it gives out a lease.

Regardless, NJ's script works as well.
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now