Solved

Add DNS Suffix  with registry script

Posted on 2008-10-14
4
6,585 Views
Last Modified: 2013-11-30
I want to modify the dns search list in the registry on a 100 plus vista enterprise machine.

I know it is in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

Does any one have a script I could double click and merge to the registry?
The users of these machines are all technically inclined and it will be a case of placing the file on a network share they could all click and add to their machines.

Something along the lines of

Mydomain.domain.co.uk
Otherdomain.thatdomain.com
Thisdomain.iwant.local

Any help will be greatly appreciated

Thanks
DB
0
Comment
Question by:doragbon
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
tchamtieh earned 250 total points
ID: 22716029
Try this script.

-Thomas
' This code will change the DNS suffix search order
' to "mycompany.com" followed by "east.mycompany.com"
' ------ SCRIPT CONFIGURATION ------
strComputer = "."
arrNewDNSSuffixOrder = Array("mycompany.com", "east.mycompany.com")
' --------- END CONFIGURATION ------
 
Set objWMIService = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set nics = objWMIService.ExecQuery _
 ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
 
Set Network = objWMIService.Get("Win32_NetworkAdapterConfiguration")
 
' now set the new DNS suffix search order
SetSuffixes = _
  Network.SetDNSSuffixSearchOrder(arrNewDNSSuffixOrder)
 
If SetSuffixes = 0 Then
  WScript.Echo "Success! Replaced DNS domain suffix search order."
ElseIf SetSuffixes = 1 Then
  WScript.Echo "Success! Replaced DNS domain suffix search order. Please reboot."
Else
  WScript.Echo "Error! Unable to replace DNS domain suffix search order list."
End If

Open in new window

0
 
LVL 70

Assisted Solution

by:Chris Dent
Chris Dent earned 250 total points
ID: 22716154

DB you know you can set this with Group Policy, right? Or are you wanting to add entries onto an existing list?

Chris
0
 

Author Comment

by:doragbon
ID: 22716331
Chris,

I have a 2000 SP4 AD where do you think I could start.

Step by step instructions will be helpful these migration process is getting the better of me .Is there an adm file you have or something really straight forward.

Lots of thanks
DB
0
 
LVL 70

Expert Comment

by:Chris Dent
ID: 22716410

The policy can only be applied to XP and above, but that shouldn't mean we can't run it on your current domain, you just need to get the template on there.

The policy we'd be looking at is built into both Vista and XP. If you could install the Group Policy Management Console onto an XP system (or 2003 server) you should be able to set it and it will upload the necessary templates to your DCs.

It hides under:

Computer Configuration / Administrative Templates / Network / DNS Client

You would add the suffixes as a comma delimited list into the "DNS Suffix Search List" policy.

Chris
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I previously wrote an article addressing the use of UBCD4WIN and SARDU. All are great, but I have always been an advocate of SARDU. Recently it was suggested that I go back and take a look at Easy2Boot in comparison.
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now