Skip navigation

Q. How do I use the command line to install Windows Server 2008 Roles and Features?

A. The Server Manager GUI is great, but it's not so wonderful for Server Core installations and some automated functions. Fortunately, Server Manager has a command-line version—servermanagercmd.exe. You can execute this command with its –query switch to list all known Roles and Features, as you see below. Installed Roles and Features are checked in the output and displayed in green.

servermanagercmd.exe -query
..

----- Roles -----

\[ \] Active Directory Certificate Services \[AD-Certificate\]
\[ \] Certification Authority \[ADCS-Cert-Authority\]
\[ \] Certification Authority Web Enrollment \[ADCS-Web-Enrollment\]
\[ \] Online Responder \[ADCS-Online-Cert\]
\[ \] Network Device Enrollment Service \[ADCS-Device-Enrollment\]
\[X\] Active Directory Domain Services
\[X\] Active Directory Domain Controller \[ADDS-Domain-Controller\]
\[ \] Identity Management for UNIX \[ADDS-Identity-Mgmt\]
..
..
----- Features -----

\[ \] .NET Framework 3.0 Features \[NET-Framework\]
\[ \] .NET Framework 3.0 \[NET-Framework-Core\]
\[ \] XPS Viewer \[NET-XPS-Viewer\]
\[ \] WCF Activation \[NET-Win-CFAC\]
\[ \] HTTP Activation \[NET-HTTP-Activation\]
\[ \] Non-HTTP Activation \[NET-Non-HTTP-Activ\]
\[ \] BitLocker Drive Encryption \[BitLocker\]
\[ \] BITS Server Extensions \[BITS\]
\[ \] Connection Manager Administration Kit \[CMAK\]
\[X\] Desktop Experience \[Desktop-Experience\]
\[ \] Failover Clustering \[Failover-Clustering\]
\[X\] Group Policy Management \[GPMC\]
\[ \] Internet Printing Client \[Internet-Print-Client\]
..
..

If you add a filename to the end of the query, the output will generate an XML file giving you the same information and the Role or Feature ID, which is required to add or remove Roles and Features from the command line. In the example below, the file has an entry for a Telnet client, and shows the friendly name and the ID.

In this case, the ID is "Telnet-Client." To install the client from the command line, I would use the command:

servermanagercmd -install telnet-client -whatif
..
Note: Running in 'WhatIf' Mode.
Specified for installation: \[Telnet Client\]

This server may need to be restarted after the installation completes.

Here, I didn't actually install anything. As with PowerShell, I can use the -whatif switch to show me what will happen if I run the command. To install the Telnet Client, just remove the -whatif switch. To uninstall a Role or Feature, use -remove instead of -install. If a server is to have many Roles and you want to install all the Role Services, use the -allsubfeatures switch to install everything for the named Role or Feature.

Hide comments

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.
Publish