Creating an Answer File for Server Manager Commands

Applies To: Windows Server 2008

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

In 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 users want to install on or remove from a server

  • Configuration settings required to complete installation of roles, role services, or features

Role, role service, and feature dependencies

When you install or remove roles, role services, or features by using the Server Manager GUI, the Add Roles Wizard verifies that all of the software required by a role installs with any role 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 want to install or remove only specific parts of roles or features, you need to specify only the parts you want to install or remove. There is no need to specify all of the required roles and role services for role services you want 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 parameter 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 role service specified in your answer file.

For example, if you want 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 are required for Internet Printing to run. By using the same answer file, you want to remove the Terminal Services role service 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 command, 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 want to install or remove.

For example, if you want 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 subordinate to Print Services.

Creating an answer file for Server Manager commands

You can create the answer file to use with the Server Manager command line in an XML editing program or in a text editing utility 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. See The Server Manager command-line schema in this topic for more information.

Note

The results of the -query parameter cannot be used as an answer file with the -inputPath parameter. The XML used by -query results and the XML required in a Servermanagercmd.exe answer file do not validate to the same schema.

Specifying the identifiers of roles, role services, and features

The Server Manager command line 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 command line are case-insensitive, 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, and to create well-formed XML, the element must be closed at the end of the answer file. The placeholder action must be replaced with either Install or Remove.

<ServerManagerConfiguration
Action="action"
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 wants to install DNS Server, Web Server (IIS), Terminal Services Gateway (a role service of Terminal Services), Message Queuing Server (part of the feature Message Queuing), 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 wants to remove 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 command line must validate to the Server Manager command-line schema definition. You can find a copy of this schema on the Microsoft Web site (https://go.microsoft.com/fwlink/?LinkId=81203).