Solved

Add DNS Suffix  with registry script

Posted on 2008-10-14
4
6,615 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

The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Tablet PCs slow responsiveness relative to other local non-tablet PCs. 10 104
DNS spf record 14 57
local DNS vendor. 4 67
web server dns redirect 5 38
I've written instructions for one router type, but this principle may be useful for others of the same brand and even other brands of router. Problem: I had an issue especially with mobile devices that refused to use DNS information supplied via…
BIND is the most widely used Name Server. A Name Server is the one that translates a site name to it's IP address. There is a new bug in BIND (https://kb.isc.org/article/AA-01272), affecting all versions of BIND 9 from BIND 9.1.0 (inclusive) thro…
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

792 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