Link to home
Start Free TrialLog in
Avatar of InsightMedia
InsightMedia

asked on

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.
Avatar of TheCleaner
TheCleaner
Flag of United States of America image

Any reason for not doing it through DHCP or even group policy?
Avatar of InsightMedia
InsightMedia

ASKER

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.    
ASKER CERTIFIED SOLUTION
Avatar of NJComputerNetworks
NJComputerNetworks
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
HKLM\System\CurrentControlSet\Services\TCPIP\Parameters\NV Domain   <--  This is the registry key for the Primary DNS Setting...

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!
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.