Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

At my work, we have two connection specific DNS suffixes. lhs.local and cis.local. I'm trying to write a batch file that will take care of a lot of the common administrative tasks that need done when we deploy a computer, and appending these is one of those tasks.

Is there a command to do this programatically?

share|improve this question
Why are you (ab?)using Zeroconf TLDs? – Ignacio Vazquez-Abrams Oct 11 '10 at 15:28
Please don't get me started, lol. Why am I the one who pioneered our imaging initiative when I'm just tier 2 support? – Chris Sobolewski Oct 11 '10 at 16:03
up vote 7 down vote accepted

Via this post

In order to add a DNS suffix to a TCP/IP connection remotely, all you need is a list of IP addresses and the following command:

wmic /USER:administrator /PASSWORD:adminpassword /node:@c:\iplist.txt nicconfig call SetDNSSuffixSearchOrder (

where C:\iplist.txt contains a list of IP addresses, line separated.

Another way is to add via the registry

reg add HKLM\System\currentcontrolset\services\tcpip\parameters /v “NV Domain” /d “” /f

There's a Microsoft KB entry for the same as well.

share|improve this answer
Using the reg method above did not work for me. So I read the KB link which talks about setting the value name to "SearchList" not, e.g. "NV Domain". Using /v SearchList worked (note it will clobber any existing domains so be sure to have them in the /d list. – Nathan Kidd Jan 25 '13 at 17:26

Based off of Sathya's answer and other resrouces, I wrote this:

@echo off
SETLOCAL EnableDelayedExpansion

:: Input here the additional suffix
set suffix=your.own.suffix

:: Get existing DNS suffixes
FOR /F "usebackq tokens=1,2* delims= " %%A in (`reg QUERY HKLM\SYSTEM\CurrentControlSet\services\Tcpip\Parameters /V SearchList ^| findstr REG_SZ`) do ( 
    set OLD_DNS=%%C

:: Check if it starts with our suffix
set OK=NO
FOR /F "tokens=1,2* delims=," %%A in ("%OLD_DNS%") do (
    if "%%A" == "%suffix%" set OK=YES

:: Add our suffix first if it's not there
if "%OK%" == "NO" (
    echo Conf KO: %OLD_DNS%
    reg add HKLM\SYSTEM\CurrentControlSet\services\Tcpip\Parameters /V SearchList /D "%suffix%,%OLD_DNS%" /F
) else (
    echo Conf OK: %OLD_DNS%

ipconfig /flushdns
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.