In large scale corporate networks, the DNS servers are very important elements in the corporate network infrastructure. Some administrators prefer DNS Command line tools in managing DNS than the graphical tools such as the DNS console, since DNS Command line tools is faster. DNS command line tools have been improved just as rich in features as the DNS console. In fact, many query and configuration tasks can be done only with a command-line tool.
Understanding how to use DNS Command line tools has some benefits, one of them is that you can create batch scripts that automate repetitive processes. With DNS command line tool you can install the Microsoft DNS Server, configure some name server settings, add a zone, create a resource record.
DNS Command line tool such as dnscmd (options for managing a Microsoft DNS Server), sc (can be used to query, start, and stop the DNS server), and sysocmgr (for installing the DNS server) can be found in the Windows Support Tools on the Windows Server 2003 CD.
Installing the DNS Server Using DNS Command Line
The Microsoft DNS Server is one of the Windows networking components which is not installed by default; it’s an optional component that can be installed using the DNS command with the sysocmgr utility. The file can be found in %SystemRoot%\system32.
How to use sysocmgr? You need to create an answer file first that specifies one or more optional components to install, but this case we will install the DNS server with the following answer file:
[netoptionalcomponents]
dns=1
When running sysocmgr, we need to specify two options. The first is /i, followed by a colon and the path to the sysoc.inf file, which is stored in the %SystemRoot%\inf directory by default. The second option is /u, followed by a colon and the path to the answer file. If the answer file is stored in the root of the C: drive and is called dns_install.txt, the full command line would look like this:
C:\> sysocmgr /i:%SystemRoot%\inf\sysoc.inf /u:c:\dns_install.txt
This starts installation of the service. You will see screens pop up as if you were installing the service through the GUI. You are prompted for the location of the Windows Server 2003 CD files, unless the sysoc.inf file points to a local drive or network share that contains the \i386 directory that can be found on the CD.
Installing the DNS server silently can be done using the /x and /q options to suppress all the screens during installation.
Sysocmgr can also be used to uninstall the DNS server. You need to change the answer file dns_install.txt as follows:
[netoptionalcomponents] dns=0
and then run sysocmgr with the same DNS command line options shown previously.
More detail information about unattended installation options and the syntax of answer files can be found from the Windows Server 2003 CD. Extract the file ref.chm from directory \support\tools\deploy.cab file.
Stopping and Starting the DNS Server Service Using DNS Command
Since the early days of Windows NT net start and net stop command line are popular command line to start and stop services, and we can also use this as DNS command line to start and stop the DNS services.
For example:
C:\> net stop dns The DNS Server service is stopping. The DNS Server service was stopped successfully.
C:\> net start dnsThe DNS Server service is starting. The DNS Server service was started successfully.
DNS commands discussed above are not used for remote server. If you need to manage the remote DNS server, you can use DNS command line sc utility. Sc utility is installed by default in Windows 2003, but for Windows 2000 you can find it in the Resource kit.
This sc DNS command can be used to start and stop remote server, for example the remote server name Tower with the following commands.
C:\> sc \\Tower stop dns SERVICE_NAME: dns TYPE : 10 WIN32_OWN_PROCESS STATE : 3 STOP_PENDING (STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN) WIN32_EXIT_CODE : 0 (0×0) SERVICE_EXIT_CODE : 0 (0×0) CHECKPOINT : 0×1 WAIT_HINT : 0×7530 C:\> sc \\Tower start dns SERVICE_NAME: dns TYPE : 10 WIN32_OWN_PROCESS STATE : 2 START_PENDING (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)) WIN32_EXIT_CODE : 0 (0×0) SERVICE_EXIT_CODE : 0 (0×0) CHECKPOINT : 0×0 WAIT_HINT : 0x7d0 PID : 504 FLAGS :As you can see, the second command returned a START_PENDING state. To verify the service started successfully, we can use the query option:
C:\> sc \\Tower query dns
SERVICE_NAME: dns TYPE : 10 WIN32_OWN_PROCESS STATE : 4 RUNNING (STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN) WIN32_EXIT_CODE : 0 (0×0) SERVICE_EXIT_CODE : 0 (0×0) CHECKPOINT : 0×0 WAIT_HINT : 0×0 DNS command sc is recommended to use instead of net command since sc is simple but much more powerful. dnscmd – DNS Command to Manage DNS Server Another straightforward DNS command you can use is dnscmd with the generic syntax as follows:
dnscmd ServerName Command AdditionalOptions
The ServerName parameter is the target of remote name server. It is optional and, if not included, it runs the command against the local server (which must be a name server). You can also use a single dot (.) to target the local server.
The Command parameter is required and corresponds to an action you can perform against the server. The Windows Server 2003 version of dnscmd supports 37 different commands. Running dnscmd from a command line without passing any parameters displays the complete list of supported commands.
The Additional Options parameter is optional for some commands, required for some, and not used for others. To see what additional parameters are needed for a command, run dnscmd Command /? from the command line.
Other Command-Line Utilities
There are still lots of DNS command you can use to troubleshooting purposes.
Nslookup
DNS command nslookup is the most widely used DNS tools to perform all types of resource record queries and even zone transfers.
The nslookup utility is installed by default on Windows 2000, Windows XP, and Windows Server 2003.
Ipconfig
The ipconfig utility is most commonly used for releasing and renewing DHCP addresses, but it is also a handy client-side DNS tool. The DNS-related ipconfig options include the following:
/displaydns
DNS Command ipconfig /displaydns will display the contents of the client resolver cache such as Record Name, Record Type, Time To Live (TTL), Data Length, Section, and RR data.
/flushdns
This option erases the contents of the resolver cache. Subsequent lookups are sent to a name server and cached again by the client after receiving a response.
/registerdns
This option causes the client to refresh its DHCP lease and its network registration (A and PTR records).
Netdiag
DNS command netdiag utility performs a variety of network connectivity tests, including a DNS test. The netdiag /test:DNS command iterates over each active network adapter and checks whether the hostname has an A record in the domain specified by the domain suffix for the adapter. If you receive an error message for the DNS test, you should run netdiag /test:DNS /debug, which will produce verbose output and help pinpoint the cause of the failure.
If you run netdiag /test:DNS on a domain controller and receive errors, you can run it again with the /fix option to force all the records in the netlogon.dns file to be refreshed in DNS. The netdiag utility is available in the Windows 2000 and Windows Server 2003 Support Tools.
dcdiag
dcdiag utility can be used to assess whether your DNS infrastructure is configured correctly to support Active Directory.
You can simulate to create a new forest, domain tree, domain, or replica domain controller by using the /test:DcPromo option. /DnsDomain: option and the name of the target domain are needed for this test purposes.
You also need to specify one additional option that indicates the type of test to run. These include: /NewForest, /NewTree, /ChildDomain, and /ReplicaDC. If you use the /NewTree option, you must also include the /ForestRoot: option followed by the name of the forest root domain. Here is an example command line to test creating a new child Active Directory domain called Tower:
C:\> dcdiag test:DcPromo /DnsDomain:tower.mine.com /ChildDomain
The other dcdiag test is RegisterInDNS. It verifies whether a domain controller can register an A record for its hostname as well as the various locator records required by Active Directory. The only additional option that is required for this command is /DnsDomain: followed by the domain that the domain controller is in.
C:\> dcdiag test:RegisterInDNS /DnsDomain:movie.edu
DNSLint
DNSLint utility will provide a way to quickly check for the existence of one or more resource records on several name servers, and can also be used to perform connectivity tests for well known email protocols (i.e., SMTP, POP, and IMAP).
dnsdiag
The dnsdiag utility can be used to troubleshoot email delivery problems that stem from DNS misconfigurations. It works by simulating the DNS activity performed by an SMTP agent that is attempting to deliver email. In order for dnsdiag to work, either Exchange or SMTP service needs to be installed on the computer that dnsdiag is run from. If neither is installed, you will see a cryptic error stating that ISATQ.dll was not found.
Check also other articles:


Advantageously, the post is really the greatest on this worthw hile topic. I agree with your conclusions and will thirstily look forward to your future updates. Saying thanks will not just be adequate, for the great lucidity in your writing. I will directly grab your rss feed to stay informed of any updates. Pleasant work and much success in your business dealings!
hi please am working with technical support team in big isp ,so please can you report me with all dns commands and internet tools
I’ll dig more about DNS commands and update this article as soon as get more. For internet tools you can check my article about Internet security tools probably it’s not complete …?
Luckily, your writing goes to the essence of the issue. Your clarity leaves me wanting to know more. Allow me to forthwith grab your feed to keep up to date with your site. Saying thanks is simply my little way of saying what a masterpiece for a wonderful resource. Accept my warmest wishes for your future post.