Stopping and Starting the DNS Server Service

There are a couple of options for stopping and starting the DNS server on Windows Server 2003. The net stop and net start commands have been around since the early days of Windows NT and are commonly used to stop and start services, if for no other reason than their availability and simplicity. You specify the name of the service after the command to stop or start it. Here is an example of restarting the DNS server in two steps using these commands:

C:\> net stop dns
The DNS Server service is stopping.
The DNS Server service was stopped successfully.

C:\> net start dns
The DNS Server service is starting.
The DNS Server service was started successfully.

While these commands are certainly easy to use, they don’t work on a remote server. If you need to stop, start, or restart the DNS server on a remote server, you’ll need to use the sc utility.

In Windows 2000, the sc utility was available in the Resource Kit. In Windows Server 2003, it’s installed with the operating system, like the syscomgr and net commands we described earlier.

Not only can sc be run against remote servers, but it provides options to perform just about any action you would need to do against a service. To restart the DNS server on a remote server named matrix, we would use the following commands:

C:\> sc \\matrix stop dns SERVICE_NAME: dns TYPE : 10 WIN32_OWN_PROCESS STATE : 3 STOP_PENDING (STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN) WIN32_EXIT_CODE : 0 (0x0) SERVICE_EXIT_CODE ...

Get DNS on Windows Server 2003, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.