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.
InsightMediaAsked:
Who is Participating?
 
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:
Any reason for not doing it through DHCP or even group policy?
0
 
NJComputerNetworksCommented:
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
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
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.