Installing Components at the Command Line

Server Manager's command-line counterpart is ServerManagerCmd.exe. When you work with ServerManagerCmd, you can:

  • View the current configuration
  • Add roles, role services, and features
  • Remove roles, role services, and features

Note You can't use ServerManagerCmd at the same time you are using one of Server Manager's add or remove wizards. Only one instance of either ServerManagerCmd or Server Manager can add or remove components at the same time.

Getting Started with ServerManagerCmd

You can manage roles, role services, and features using the following commands and command-line syntaxes:

  • -query Obtains a detailed list of the server's current state with regard to roles, role services, and features. If SaveFile.xml is specified, the query results are displayed and saved to the named file, in XML format. Optionally, you can use -q instead of -query.

    ServerManagerCmd -query [SaveFile.xml] [-logPath LogFile.txt]
    
  • -install Installs the named role, role service, or feature. The -allSubFeatures or -a parameter allows you to install all subordinate role services and features of the named component. The -setting or -s parameter allows you to configure required settings to specific values. Optionally, you can use -i instead of -install.

    ServerManagerCmd -install ComponentName [-setting SettingName=SettingValue]
    [-allSubFeatures] [-resultPath Results.xml] [-restart] | -whatIf]
    [-logPath LogFile.txt]
    
  • -inputPath Adds or removes roles, role services, and features as specified in an XML answer file. Optionally, you can use -ip instead of -inputPath.

    ServerManagerCmd -inputPath AnswerFile.xml [-resultPath Results.xml] [-restart] 
    | -whatIf] [-logPath LogFile.txt]
    
  • -remove Removes the named role, role service, or feature. Optionally, you can use -r instead of -remove.

    ServerManagerCmd -remove ComponentName [-resultPath Results.xml]
    [-restart] | -whatIf] [-logPath LogFile.txt]
    
  • -version Lists the version of the Server Manager command-line utility being used. Optionally, you can use -v instead of -version.

    ServerManagerCmd -version
    

Each of the commands accepts additional parameters and parameter values. Most commands and parameters have short forms that can be used instead of the full name. You can use the -logPath or -l parameter to log error details to a named log file. With the -install and -remove commands, you can use the -whatif or -w command to display the operations that would be performed if the command were executed. With the -install and -remove commands, you can use the -resultPath or -rp command to write standard output results to a named file in XML format. With the -install and -remove commands, you also can use the -restart command to restart the computer automatically (if restarting is necessary to complete the operation).

The parameter values that can be used with commands include:

  • AnswerFile.xml Uses the XML-formatted answer file to determine what components to add or remove.
  • SaveFile.xml Saves the standard output results to a named file in XML format. The results are still displayed and it is important to note that results do not include errors, which are written separately to standard error output.
  • ComponentName Identifies the role, role service, or feature to work with.
  • SettingName Identifies a required setting by its name.
  • SettingValue Sets the configuration value for a setting.
  • LogFile Sets the name of the text file to which log error details should be written.
  • Results.xml Saves the results of the install or remove operation to a named file in XML format. Results are still displayed.

Table 7-3 provides a quick reference for the long and short form parameters for ServerManagerCmd.

Table 7-3 Long and Short Form Parameters for ServerManagerCmd

Dd184077.table_C07624382_3(en-us,TechNet.10).png

Understanding Component Names

Just about every installable role, role service, and feature has a component name. This name identifies the component so it can be manipulated from the command-line. Remember, supplemental components are made available by downloading and installing their installer packages from the Microsoft Web site.

Table 7-4 provides a hierarchical listing of the component names associated with roles, related role services, and related subcomponents. When you are installing a role, you can use the -allSubFeatures parameter to install all the subordinate role services and features listed under the role. When you are installing a role service, you can use the -allSubFeatures parameter to install all the subordinate features listed under the role service.

Table 7-4 Component Names for Key Roles and Role Services

Dd184077.table_C07624382_4(en-us,TechNet.10).png

Table 7-5 provides a hierarchical listing of the component names associated with features and related subfeatures. When you are installing a feature, you can use the -allSubFeatures parameter to install all the subordinate second-level and third-level features listed under the feature. When you are installing a second-level feature, you can use the -allSubFeatures parameter to install all the subordinate third-level features listed under the second-level feature.

Note An asterisk following the feature command indicates the feature has unlisted subordinate features that generally are installed together by adding the -allSubFeatures parameter.

Table 7-5 Component Names for Features and Subfeatures

Dd184077.table_C07624382_5(en-us,TechNet.10).png

Determining the Installed Roles, Role Services, and Features

You can determine the roles, roles services, and features that are installed on a server by typing servermanagercmd -query at an elevated command prompt. Each installed role, role service, and feature is highlighted and marked as such, and following the display name of each role, role service, and feature is the management naming component in brackets. In the output, roles and role services are listed before features as shown in the following example:

----- Roles -----
[X] Active Directory Certificate Services  [AD-Certificate]
    [X] Certification Authority  [ADCS-Cert-Authority]
    [X] 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]
        [ ] Server for Network Information Services  [ADDS-NIS]
        [ ] Password Synchronization  [ADDS-Password-Sync]
        [ ] Administration Tools  [ADDS-IDMU-Tools]

...

----- Features -----
[X] .NET Framework 3.0 Features  [NET-Framework]
    [X] .NET Framework 3.0  [NET-Framework-Core]
    [ ] XPS Viewer  [NET-XPS-Viewer]
    [X] WCF Activation  [NET-Win-CFAC]
        [X] HTTP Activation  [NET-HTTP-Activation]
        [X] Non-HTTP Activation  [NET-Non-HTTP-Activ]
[X] BitLocker Drive Encryption  [BitLocker]
[X] BITS Server Extensions  [BITS]

For the purposes of documenting a server's configuration, you can save the output in a file as standard text using the redirection symbol (>) as shown in this example:

servermanagercmd -query > MySavedResults.txt

Here, you save the output to a file named MySavedResults.txt. If you want to save the results as an XML-formatted file, simply follow the -query command with the name of the XML file, such as:

servermanagercmd -query MySaveFile.xml

Saving the output to an XML file makes the file easier to manipulate using automation techniques.

Installing Components Using ServerManagerCmd

You can install roles, role services, and features by typing servermanagercmd -install ComponentName at an elevated command prompt, where ComponentName is the name of the component to install as listed in Table 7-4 or Table 7-5. You can install subordinate components by including the -allSubFeatures parameter as shown in the following example:

servermanagercmd -install fs-dfs -allsubfeatures

Here, you install the Distributed File System role service as well as the subordinate DFS Namespaces and DFS Replication role services. The output for a successful installation should look similar to the following:

Start Installation...
[Installation] Succeeded: [File Services] Distributed File System.
[Installation] Succeeded: [File Services] DFS Namespaces.
[Installation] Succeeded: [File Services] DFS Replication.
<100/100>

Success: Installation succeeded.

Should a restart be required to complete an installation, you can have ServerManagerCmd restart the computer by including the -restart parameter. To test the installation prior to performing that actual operation, you can use the -whatif parameter. If you are trying to install components that are already installed you'll see a note stating that no changes were made, such as:

NoChange: No changes were made because the roles, role services and features specified are already installed, or have already been removed from the local computer.

If an error occurs and ServerManagerCmd is not able to perform the operation specified, you'll see an error. Generally, error text is shown in red and includes an error flag and error text, such as:

WriteError: Failed to write the log file: . Access to the path 'C:\Windows\logs\ServerManager.log' is denied.

This error indicates that ServerManagerCmd couldn't perform the operation because it couldn't gain write access to the log file. Other common errors you'll see are related to invalid arguments passed on the command line, such as:

ArgumentNotValid: Invalid parameters. Only specify either -install or -remove.
ArgumentNotValid: Invalid role, role service, or feature: 'fs-dfsd'. The name was not found.

Note If you forget to run the command prompt as an administrator, you'll see an error stating that Server Manager can be run only by a member of the built-in Administrators group on the local computer. You'll need to run the command prompt with elevated permissions to resolve this error.

When you install components, ServerManagerCmd writes extended logging information to %SystemRoot%\Logs\Servermanager.log. This logging information details every operation performed by ServerManagerCmd. You can write the detailed information to an alternate location by including the -logPath or -l parameter. In this example, you write the logging information to C:\Logs\Install.log:

servermanagercmd -install fs-dfs -allsubfeatures -logPath c:\logs\install.log

Removing Components Using ServerManagerCmd

You can uninstall roles, role services, and features by typing servermanagercmd --remove ComponentName at an elevated command prompt, where ComponentName is the name of the component to uninstall as listed in Table 7-4 or Table 7-5. You can uninstall subordinate components by including the -allSubFeatures parameter as shown in the following example:

servermanagercmd -remove fs-dfs -allsubfeatures

Here, you uninstall the Distributed File System role service as well as the subordinate DFS Namespaces and DFS Replication role services, and the output for a successful removal should look similar to the following:

Start Removal...
[Removal] Succeeded: [File Services] Distributed File System.
[Removal] Succeeded: [File Services] DFS Namespaces.
[Removal] Succeeded: [File Services] DFS Replication.
<100/100>

Success: Removal succeeded.

Should a restart be required to complete a removal, you can have ServerManagerCmd restart the computer by including the -restart parameter. As with installation, you can test the removal prior to performing that actual operation using the --whatif parameter. If?you are trying to remove components that aren't installed, you'll see a note stating that no changes were made, such as:

NoChange: No changes were made because the roles, role services and features specified are already installed, or have already been removed from the local computer.

If an error occurs and ServerManagerCmd is not able to perform the operation specified, you'll see an error. During the removal process, ServerManagerCmd writes extended logging information to %SystemRoot%\Logs\Servermanager.log. As with the installation process, you can write the detailed information to an alternate location by including the -logPath or -l parameter.

< Back     

 

 

© Microsoft. All Rights Reserved.