Control Windows Server 2008 Roles and Features

Eschew the Server Manager GUI and reach for the command line

Executive Summary:

Windows Server 2008 has abandoned the familiar Computer Management console, and you’re left with the unwieldy Server Manager GUI tool. But if you’re faced with the prospect of rolling out dozens, hundreds, or thousands of servers, your best bet is to use the tool’s less celebrated command-line brethren, ServerManagerCmd, Ocsetup, and Oclist.

By the time you read this column, Microsoft will have released Windows Server 2008. Even if you’ve decided not to immediately upgrade to the new server OS, y probou’reably setting up a few test servers to try it out. And as you tinker with these fresh Server 2008 systems, you’ll begin making observations.

First, Computer Management is gone! Right-clicking Computer and choosing Manage brings up not the familiar Computer Management console but rather the new Server Manager console. And if you try to use Server Manager to add, say, the DNS Server service, you’ll see that you’re now dealing with roles and features. Second, you can no longer use Control Panel’s Add/Remove Windows Components applet. It doesn’t exist in the new OS, so you’ll be forced to use the newfangled Server Manager tool.

Pshaw, I say. Eventually, you’re going to be faced with the prospect of rolling out dozens, hundreds, or thousands of servers and—let’s all say it together—you’re not going to use the Server Manager console to do it. Instead, let me introduce you to the tool’s less celebrated command-line brother, ServerManagerCmd (servermanagercmd. exe), and its cousins Ocsetup (ocsetup. exe) and Oclist (oclist.exe). ServerManagerCmd works only if you’re running the “full” (GUI-equipped) version of Server 2008. (I’ll get to the Server Core commands in a bit.)

Working from an elevated command prompt (as always) in Server 2008, type

servermanagercmd -query

This simplest of ServerManagerCmd commands will display several screens that show all the add-on capabilities that your server currently has and hasn’t enabled. (I say “capabilities” because Server 2008 breaks them into roles and features, and I haven’t figured out the difference. Given that DNS is a role and WINS is a feature, can we assume that roles are cool and features are less so?) One such line might look like

\[ \] DNS Server \[DNS\]

where DNS Server means that the server has the potential to become a DNS server, the empty opening brackets mean that you haven’t enabled the service (if you did enable it, an X would appear between the brackets), and—most important—\[DNS\] informs ServerManager- Cmd that you want to perform a task involving the DNS server service.

That terminology is the key to making this server capable of acting as a DNS server:

servermanagercmd -install dns

Notice that ServerManagerCmd recognizes the DNS role but is case-insensitive.

Ocsetup and Oclist
Now, if you’re setting up DNS on a Server Core installation of Server 2008 rather than a full installation, you’ll find no ServerManagerCmd tool; instead, to list the capabilities you do and don’t have installed, you can type


You’ll see output similar to that which ServerManager- Cmd -query provides, but the official names for the roles and features are lengthier. For example, the DNS line looks like

Not Installed:DNS-Server-Core-Role

To install a role or feature, just use Ocsetup, followed by the role or feature’s name. To install DNS, for example, you’d type

ocsetup DNS-Server-Core-Role

Note that you don’t need an -install option. Ocsetup only installs and uninstalls; it has no option like -query because the separate Oclist program fills that need.

You’ll also find that, like many Server Core– specific commands, Ocsetup is one of those “strong, silent type” commands. If you’ve typed an Ocsetup command with correct syntax, your only response is another command prompt. Be aware, though, that just because you’ve gotten another command prompt doesn’t mean that Server Core has finished installing the DNS server role. Occasionally, I’ve gotten in trouble by assuming that. Now, I use the belt-andsuspenders technique of running Oclist on a Server Core system to be certain that my desired role has been installed.

Command-Line Power
Honestly, would you rather click through Server Manager to install DNS when you can just type

servermanagercmd -install dns

from the command line? Of course not! So go out and buy one of those comfortable keyboards, because Server 2008 is here!

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.