Creating an Answer File for Server Manager Commands

The Server Manager command-line installation in Windows Server® 2008 accepts parameters to install or to remove one role, role service, or feature per command instance. When you intend to install or to remove more than one role, role service, or feature on a server by using a single command instance, use an XML answer file.

In this version of Windows Server 2008, users create answer files from scratch. The answer file provides the following information to the Server Manager command-line interface:

  • Roles, role services, and features that users intend to install on or to remove from a server

Roles, role services, and feature dependencies

When you install or remove roles, role services, or features by using the Server Manager graphic user interface (GUI), the Add Roles Wizard verifies that all the software required by a role installs with any role that you select in the wizard. If necessary, the wizard prompts you to approve the installation of other roles, role services, or features that are required by roles you select.

The same verification process occurs when you use the Server Manager command line. If you intend to install or to remove only specific parts of roles or features, you need to specify only the parts that you intend to install or to remove. There is no need to specify all the required roles and role services for role services that you intend to install; Server Manager automatically installs or removes the software upon which your desired role service is dependent.

Important

When you remove roles by using an answer file, Server Manager automatically removes all roles and role services that depend on a specified role or role service in your answer file. Adding the -whatIf option to your Server Manager command displays a list of all roles and role services that are removed as a consequence of removing a role or a role service specified in your answer file.

For example, if you intend to install Internet Printing, a role service of Print Services, your answer file needs to specify only Internet Printing; you do not need to specify Web Server (IIS) or specific role services of Web Server (IIS). By default, Server Manager installs parts of Web Server (IIS), another role, which is required for Internet Printing to run. By using the same answer file, you remove the Terminal Services role service Terminal Services Gateway (TS Gateway) from the same server. TS Gateway also requires parts of Web Server (IIS) to run. Server Manager removes those role services of Web Server (IIS) that neither TS Gateway nor Internet Printing require to run, but it retains Web Server (IIS) role services still required by Internet Printing.

How the answer file handles parent and child role services

Some roles, role services, and features are containers of child elements that Server Manager installs by default. In the wizards that are part of the Server Manager GUI, when you select a container node for either installation or removal, required child elements are automatically selected. Although you can clear check boxes manually for some child elements, the selected child elements are recommended defaults.

When a container is specified in a command-line installation, the default child elements are automatically included. When a container is specified in a command-line removal, all child elements are removed. For example, when the Print Services role is named in the answer file along with the -install option, the Print Server role service is also installed. However, specifying the removal of the Print Services container results in the removal of the entire role.

If default child elements should not be installed, do not specify the container in the answer file. Specify only the child elements that you intend to install or to remove.

For example, if you intend to install Internet Printing, a role service of Print Services, your answer file needs to specify only Internet Printing; you do not need to specify Print Services or other role services of Print Services. Server Manager installs only Internet Printing and the Print Server role service that it requires, but not LPD Service, another role service that is subordinate to Print Services.

Creating an answer file for Server Manager commands

You can create the answer file to use with the Server Manager commands in an XML editing program or in a text editor such as Notepad. It is recommended that you use an XML editor that can validate your work to an existing XML schema, because it is important to validate your answer file to the Server Manager command-line schema definition. For more information, see "The Server Manager Command-line Schema," later in this topic.

Specifying the identifiers of roles, role services, and features

The Server Manager commands and answer file recognizes the identifiers of roles, role services, and features provided in Overview of Server Manager Commands. Identifiers of roles, role services, and features in the answer file and in the Server Manager commands are not case-sensitive, so the capitalization shown in the identifiers is not essential.

Answer file examples

The following are sample answer files. Note that the following heading element must be present in all answer files. To create well-formed XML, you must close the element at the end of the answer file. The placeholder action must be replaced with either Install or Remove.

<ServerManagerConfiguration
Action="Install"
xmlns="https://schemas.microsoft.com/sdm/Windows/ServerManager/ Configuration/2007/1">
…answer file content…
</ServerManagerConfiguration>

Installing DNS Server, Web Server, Terminal Services Gateway, Message Queuing Server, and .NET Framework 3.0 Features

In the following example, the administrator plans on installing DNS Server, Web Server (IIS), Terminal Services Gateway (a role service of Terminal Services), Message Queuing Server (part of the Message Queuing feature), and all parts of .NET Framework 3.0 Features.

<ServerManagerConfiguration
Action="Install"
xmlns="https://schemas.microsoft.com/sdm/Windows/ServerManager/ Configuration/2007/1">
<Role Id="DNS"/>
<Role Id="Web-Server"/>
<RoleService Id="TS-Gateway"/>
<Feature Id="MSMQ-Server"/>
<Feature Id="Net-Framework" InstallAllSubFeatures="true"/>
</ServerManagerConfiguration>

The following are the results of this operation.

  • DNS Server: Installed.
  • Web Server (IIS): Has a number of default role services and a dependency on the Windows Activation Service (WAS) feature. All default role services and WAS are installed.
  • Terminal Services: The TS Gateway role service is installed, meaning the Terminal Services role is now installed. TS Gateway depends on several Web Server (IIS) role services, along with Network Policy and Access Services, which is also installed.
  • Message Queuing: Only the Message Queuing Server feature element is installed. Other elements of Message Queuing are not installed.
  • .NET Framework 3.0 Features: All sub-features of .NET Framework 3.0 Features are installed.

Removing DNS Server, Terminal Services Gateway, and .NET Framework 3.0 Features

In the following example, the administrator plans on removing DNS Server, TS Gateway, and .NET Framework 3.0 Features.

<ServerManagerConfiguration
Action="Remove"
xmlns="https://schemas.microsoft.com/sdm/Windows/ServerManager/Configuration/2007/1">
<Role Id="DNS"/>
<RoleService Id="TS-Gateway"/>
<Feature Id="Net-Framework"/>
</ServerManagerConfiguration>

The following are the results of this operation.

  • DNS Server: Removed
  • Terminal Services: The TS Gateway role service is removed. Other installed role services of Terminal Services are not removed. Web server (upon which TS Gateway was dependent) is not removed.
  • .NET Framework 3.0 Features: All sub-features of .NET Framework 3.0 are removed. If some sub-features were not previously installed, they are ignored.

The Server Manager command-line schema

XML answer files that are used with the Server Manager commands must validate to the Server Manager command-line schema definition. You can find a copy of this schema on the Microsoft Web site.