Script to append DNS suffixes

Jonny Two Shoes

Expert Member
Joined
Nov 13, 2006
Messages
4,542
Reaction score
17
Location
Gauteng
Im just looking for a basic vbs script that will automatically add to and apply the list under "Append these DNS suffixes (in order)". This can be found under network properties/IProtocol/Advanced/DNS

I have a long list I would like to add to every workstation I install and doing this with a script instead of manually would be best.

I am new to vbs scripting so pls keep it simple if possible. I have heard of such a script before so pretty confident it is possible.
Am googling as we speak :p

Many thanks.
 
Last edited:
Not sure how. These are DNS suffixes of which some relate to North America and many others. There are about ten of them. We have a leased line to Chicago so I don't have full control of the network by any means.

Would just like to add these to each workstation a lot faster. I am trying to cut down on laptop/desktop rollout time as a small goal.

EDIT: off topic -- corporate gave us an image which takes a good two hours to install before we can even begin to customize a laptop for a user. Not my idea of the purpose of an image so I made my own with BartPE using their image. So Im looking for further time saving schemes :)
 
Last edited:
Here we go.

Computer Configuration->Administrative Templates->Network->DNS Client

Inside that you will find "Primary DNS Suffix" and "DNS Suffix Search List".

That'll do the trick.
 
heh :) that would work as well. However I have to convince the network admin here to change group policies then :/

I found this:

On Error Resume Next

SET WSHShell = CreateObject("WScript.Shell")
WSHShell.RegWrite
"HKLM\System\CurrentControlSet\Services\Tcpip\Parameters\SearchList",
"DNS suffix", "REG_SZ"
SET WSHShell = Nothing


but it gives me an expected statement error on line 5 (HKLM\System....). If someone could just correct the syntax for me :) I know that regkey is definately what holds the DNS suffix list info
 
Script

I Fiddled around in dhcp console for a while (nearly broke it)
Decided to look for script and found something for you.


' This VBScript code adds a domain suffix that can be used by clients in the domain.

' ---------------------------------------------------------------
' From the book "Active Directory Cookbook" by Robbie Allen
' ISBN: 0-596-00466-4
' ---------------------------------------------------------------

' ------ SCRIPT CONFIGURATION ------
strDNSSuffix = "<DNSSuffix>" ' e.g. othercorp.com
strDomain = "<DomainDNSName>" ' e.g. amer.rallencorp.com
' ------ END CONFIGURATION ---------

set objRootDSE = GetObject("LDAP://" & strDomain & "/RootDSE")
set objDomain = GetObject("LDAP://" & objRootDSE.Get("defaultNamingContext") )
objDomain.Put "msDS-AllowedDNSSuffixes", strDNSSuffix
objDomain.SetInfo

WScript.Echo "Added " & strDNSSuffix & " to suffix list."

And here's the link
Hope it helps, I reckon Group Policy is probably going to be the best move.
 
Kom aan meneer twee skoen, jy moet vir die blerrie admin se wat is goed vir die besigheid.

All processes like that should be managed from a central location. That is the whole purpose of AD and policies.
 
heh :) that would work as well. However I have to convince the network admin here to change group policies then :/

I found this:

On Error Resume Next

SET WSHShell = CreateObject("WScript.Shell")
WSHShell.RegWrite
"HKLM\System\CurrentControlSet\Services\Tcpip\Parameters\SearchList",
"DNS suffix", "REG_SZ"
SET WSHShell = Nothing


but it gives me an expected statement error on line 5 (HKLM\System....). If someone could just correct the syntax for me :) I know that regkey is definately what holds the DNS suffix list info

Shouldnt the Network Admin be dealing with these issues ? or is it your own little project.Anyway as mentioned it is done via DHCP or Group Policy
 
Shouldnt the Network Admin be dealing with these issues ? or is it your own little project.Anyway as mentioned it is done via DHCP or Group Policy

Unfortunately our entire IT/MIS staff at this world-wide international company in the South African\jo'burg affiliate consists of three people including the manager.

So the network admin has very little time on her hands and our jobs overlap a lot :(

As I have officially been employed for almost four months now Im still getting to grips with their policies and systems etc.

Call it 6 months including contract time
 
Last edited:
Top
Sign up to the MyBroadband newsletter
X