Chapter 13. Managing DNS from the Command Line

"I daresay you haven't had much practice," said the Queen. "When I was your age, I always did it for half-an-hour a day. Why, sometimes I've believed as many as six impossible things before breakfast. There goes the shawl again!"

Knowledgeable administrators can perform tasks much faster using command-line tools than with graphical tools, such as the DNS console. Fortunately for us, Microsoft has steadily improved in this area, and the DNS command-line tools available with Windows Server 2003 are 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.

Another benefit of understanding how to use command-line tools is that you can create batch scripts that automate repetitive processes. In this chapter, we will show you how easy it is to create a simple batch script that installs the Microsoft DNS Server, configures some name server settings, adds a zone, creates a resource record, and toasts some bread. All right, maybe it can't toast bread, but you get the idea. And don't worry if scripting isn't your cup of tea; Windows batch scripts, in their most basic form, contain nothing more than a list of commands to execute. Our script is a little more complicated than that, but not much.

Throughout this book we've shown you how to configure a Microsoft DNS Server using the DNS console. The command-line counterpart to the DNS console is dnscmd, which is available in the Windows Support Tools on the Windows Server 2003 CD. dnscmd includes the proverbial kitchen sink of options for managing a Microsoft DNS Server. We spend most of our time in this chapter reviewing dnscmd. We also cover other useful utilities such as sysocmgr, for installing the DNS server; and sc, which can be used to query, start, and stop the DNS server. At the end of the chapter, we provide a list of other DNS-related command-line tools that are useful for querying and troubleshooting DNS.