13.2. Starting and Stopping the DNS Server


You want to start or stop the DNS Server.


Using a graphical user interface

  1. From the Administrative Tools, open the DNS snap-in (dnsmgmt.msc).

  2. In the left pane, right-click on the server and select All Tasks. From here you can select either Stop to stop the DNS Server or Start to start it.

Using a command-line interface

You can use the net.exe command to stop or start the DNS Server service on the local machine:

> net stop dns 
> net start dns

If you want to stop or start DNS Server remotely, use the sc.exe command:

> sc \\<ServerName> stop dns
> sc \\<ServerName> start dns

Using VBScript

' This code restarts the DNS Server on the specified host.
strServer  = "<ServerName>"  ' e.g., dns1.rallencorp.com
' ------ END CONFIGURATION ---------
on error resume next
set objDNS = GetObject("winMgmts:\\" & strServer & "\root\MicrosoftDNS")
set objDNSServer = objDNS.Get("MicrosoftDNS_Server.Name="".""")
if Err Then
  WScript.Echo "StopService failed: " & Err.Description
end if
if Err Then
  WScript.Echo "StartService failed: " & Err.Description
end if
WScript.Echo "Restart successful"


DNS Server runs as a service, which means you can also use the Services snap-in (services.msc) to start and stop it. When you stop DNS Server, it will no longer respond to DNS queries. You will also not be able to configure DNS Server while it ...

Get Windows Server Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.