共用方式為


Overview of Server Manager Commands

Applies To: Windows Server 2008

Server Manager in Windows Server® 2008 offers a command-line tool, ServerManagerCmd.exe, to enable users to perform automated installations or removals of roles, role services, and features. ServerManagerCmd.exe options enable users to view logs of its operations, and run queries to display lists of roles, role services, and features both installed and available for installation on a computer.

ServerManagerCmd.exe can be used with an XML answer file to expedite repetitive automated installations or removals of roles or features. For more information about the answer file you can use with ServerManagerCmd.exe, see Creating an Answer File for Server Manager Commands.

The Server Manager command line, pkgmgr, and ocsetup

The Server Manager command line differs from earlier command-line tools, such as pkgmgr and ocsetup, that are used to install and remove Windows software packages. The Server Manager command-line utility is the recommended tool for installing or removing roles, role services, and features on a computer running Windows Server 2008.

The following list includes ways in which the Server Manager command line differs from pkgmgr and ocsetup, and describes advantages for administrators who want to deploy a server as efficiently as possible.

  • The Server Manager command line is consistent in function and terminology with the roles, role services, and features deployment and management capabilities of the Server Manager console in the Windows Server 2008 UI.

  • The type of packages or files in which a role, role service, or feature are contained need not be known by users; the Server Manager command line requires only the name of the role, role service, or feature that the administrator wants to install or remove. Administrators do not need to provide any path or file names of role, role service, or feature packages.

  • Administrators do not need to specify dependencies between roles, role services, and features when they are using the Server Manager command line. The Server Manager command line utility automatically installs any other software packages that are required to use the role, role service, or feature specified in the command.

  • If problems occur with an installation or removal, error handling for ServerManagercmd.exe simplifies troubleshooting and provides clear actions to the user.

  • The -whatIf parameter of ServerManagercmd.exe allows users to verify what actions their commands will perform before they execute commands and modify the system. There is no comparable command parameter included with pkgmgr and ocsetup.

  • The -query parameter provides users with a complete view of which roles, role services, and features are available for installation on the computer, and which are currently installed. There is no comparable command parameter included with pkgmgr and ocsetup.

  • Both the input and output of the Server Manager command line is XML based. ServerManagercmd.exe accepts an XML answer file itemizing roles, role services, and features to be installed or removed. Both the results of installation and removal operations, and -query results can be exported to XML files. This enables automation scenarios in which other software can generate and interpret the XML files that are used with the Server Manager command-line utility.

The ServerManagerCmd.exe command

The Server Manager command-line installation accepts parameters to install or remove one or more roles, role services, and features that are separated by spaces. When you want to install or remove more than one role, role service, or feature on a server by using a single command instance, you can also use an XML answer file, especially if you want to configure multiple servers identically. For more information about the answer file you can use with ServerManagerCmd.exe, see Creating an Answer File for Server Manager Commands.

Note

ServerManagerCmd.exe can be executed from within any directory on the server's local drives. You must be a member of the Administrators group on the server on which you want to install or remove software.

Important

Because of security restrictions imposed by User Account Control in Windows Server 2008, you must run ServerManagerCmd.exe in a Command Prompt window opened with elevated privileges. To do this, right-click the Command Prompt executable, or the Command Prompt object on the Start menu, and then click Run as administrator.

Syntax

ServerManagerCmd.exe -query [<query.xml>] [-logPath <log.txt>]

ServerManagerCmd.exe -inputPath <answer.xml> [-resultPath <result.xml> [-restart] | -whatIf] [-logPath <log.txt>]

ServerManagerCmd.exe -install <command-Id> [-setting <setting-name>=<setting value>]* [-allSubFeatures] [-resultPath <result.xml> [-restart] | -whatIf] [-logPath <log.txt>]

ServerManagerCmd.exe -remove <command-Id> [-resultPath <result.xml> [-restart] | -whatIf] [-logPath <log.txt>]

ServerManagerCmd.exe [-help | -?]

ServerManagerCmd.exe -version

Parameters

Parameter Description

-query [<query.xml>]

Displays a list of all roles, role services, and features installed and available for installation on the server. You can also use the short form of this parameter, -q.

If you want the query results saved to an XML file, specify an XML file to replace query.xml.

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.

-inputPath <answer.xml>

Installs or removes the roles, role services, and features specified in the answer file, an XML file represented by answer.xml. You can also use the short form of this parameter, -p.

For more information about creating an answer file for use with this parameter, see Creating an Answer File for Server Manager Commands.

-install <Id>

Installs the role, role service, or feature specified by Id. See Role, role service, and feature command identifiers in this topic for a complete list of the role, role service, or feature identifiers from which you can choose to specify for Id. The identifiers are case-insensitive. Multiple roles, role services, and features must be separated by spaces.

The following optional parameters are used with the -install parameter.

  • -setting <setting name>=<setting value> – Specify required settings for the installation. See Role, role service, and feature command identifiers in this topic for a complete list of available settings.

  • -allSubFeatures – Specify the installation of all subordinate services and features along with the parent role, role service, or feature named in the -install command's Id parameter. Note that some role containers do not have a command line identifier to allow installation of all role services. This is the case when role services cannot be installed in the same instance of the Server Manager command. For example, the Federation Service role service of Active Directory Federation Services and the Federation Service Proxy role service cannot be installed by using the same Server Manager command instance.

  • -resultPath <result.xml> – Saves installation results to an XML file represented by result.xml. You can also use the short form of this parameter, -r. You cannot use the -resultPath parameter and the -whatIf parameter in the same instance of ServerManagerCmd.exe.

  • -restart – Adding -restart to the -install command restarts the computer automatically when installation is complete, if restarting is required by the roles or features installed.

  • -whatIf – You can use -whatIf to display any operations specified for the -install command. You can also use the short form of the -whatIf parameter, -w. You cannot use the -resultPath parameter and the -whatIf parameter in the same instance of ServerManagerCmd.exe.

  • -logPath <log.txt> – Use -logPath to specify a name and location for the log file, other than the default, %windir%\temp\servermanager.log.

-remove <Id>

Removes the role, role service, or feature specified by Id. See Role, role service, and feature command identifiers in this topic for a complete list of the role, role service, and feature identifiers from which you can choose to specify for Id. The identifiers are case-insensitive. Multiple roles, role services, and features must be separated by spaces.

The following optional parameters are used with the -remove parameter.

  • -resultPath <result.xml> – Saves removal results to an XML file represented by result.xml. You can also use the short form of this parameter, -r. Note that you cannot use the -resultPath parameter and the -whatIf parameter in the same instance of ServerManagerCmd.exe.

  • -restart – Adding -restart to the -remove command restarts the computer automatically when removal is complete, if restarting is required by remaining roles or features.

  • -whatIf – You can use -whatIf to display any operations specified for the -remove command. You can also use the short form of the -whatIf parameter, -w. You cannot use the -resultPath parameter and the -whatIf parameter in the same instance of ServerManagerCmd.exe.

  • -logPath <log.txt> – Use -logPath to specify a name and location for the log file, other than the default, %windir%\temp\servermanager.log.

-help

Display Help for ServerManagerCmd.exe in the command window. You can also use the short form, -?.

-version

Display the Server Manager version number. You can also use the short form, -v.

Role, role service, and feature command identifiers

The tables in this section match roles, role services, and features available in Windows Server 2008 with the command identifiers you must use with ServerManagerCmd.exe to install or remove them.

Role and Role Service command identifiers

Active Directory Certificate Services command identifiers Command value Notes

Active Directory Certificate Services

(No command)

Certification Authority and Online Certificate Status Protocol can be installed by using the Server Manager command-line interface. Other role services for Active Directory Certificate Services cannot be installed by using the Server Manager command line.

Certification Authority

ADCS-Cert-Authority

Certification Authority Web Enrollment (not installable by using the command line)

AD-Certificate

Online Certificate Status Protocol

ADCS-Online-Cert

Microsoft Simple Certificate Enrollment Protocol (not installable by using the command line)

(No command)

Active Directory Domain Services command identifiers Command value Notes

Active Directory Domain Services

(No command)

After installing Active Directory Domain Services (AD DS), you must run the dcpromo command to promote the server to a domain controller.

Removing the AD DS role while the computer is operating as a domain controller fails. You must first demote the domain controller to a standard domain member.

Active Directory Domain Controller

ADDS-Domain-Controller

Identity Management for UNIX

ADDS-Identity-Management

Server for Network Information Service

ADDS-NIS

Password Synchronization

ADDS-Password-Sync

Administration tools for Identity Management for UNIX

ADDS-IDMU-Tools

Active Directory Federation Services command identifiers Command value Notes

Active Directory Federation Services

(No command)

Active Directory Federation Services should be installed with default settings.

Federation Service

ADFS-Federation

Federation Service Proxy

ADFS-Proxy

Web Agents

ADFS-Web-Agents

Claims-aware Agent

ADFS-Claims

Windows Token-based Agent

ADFS-Windows-Token

Active Directory Lightweight Directory Services command identifiers Command value Notes

Active Directory Lightweight Directory Services

ADLDS

None

Active Directory Rights Management Services (AD RMS) command identifiers Command value Notes

Active Directory Rights Management Services (AD RMS)

Active Directory Rights Management Services (AD RMS) cannot be installed by using the Server Manager command line.

None

Application Server command identifiers Command value Notes

Application Server

Application-Server

If you install the WS-Atomic Transaction Support role service by using the Server Manager command line, by default, WS-Atomic Transaction Support is configured to use a self-signed certificate.

Application Server Core

AS-AppServer-Core

Web Server Support

AS-Web-Support

COM+ Network Access

AS-Ent-Services

TCP Port Sharing

AS-TCP-Port-Sharing

Windows Process Activation Service Support

AS-WAS-Support

HTTP Activation

AS-HTTP-Activation

Message Queuing Activation

AS-MSMQ-Activation

TCP Activation

AS-TCP-Activation

Named Pipes Activation

AS-Named-Pipes

Distributed Transaction Support

AS-Dist-Transaction

Incoming Remote Transactions

AS-Incoming-Trans

Outgoing Remote Transactions

AS-Outgoing-Trans

WS-Atomic Transaction Support

AS-WS-Atomic

DHCP Server command identifiers Command value Notes

DHCP Server

DHCP

The DHCP Server role should be installed with default settings.

DNS Server command identifiers Command value Notes

DNS Server

DNS

None

Fax Server command identifiers Command value Notes

Fax Server

Fax

Fax Server should be installed with default settings.

File Services command identifiers Command value Notes

File Services

(No command)

You cannot install or remove the File Services container by using the Server Manager command line. You can install or remove the File Services container only by using the Server Manager user interface. Note that for this reason, there is no command ID available to represent the File Services container.

Because you can configure File Services settings after installing the role, you are not required to specify File Services settings in the Server Manager command-line answer file.

Note that Services for Network File system is not part of the File Services role on computers running Windows Server 2008 for Itanium-based Systems; it is available as a role service of File Services only on the 32-bit and 64-bit versions of Windows Server 2008.

File Server

FS-Fileserver

Distributed File System (DFS)

FS-DFS

DFS Namespace

FS-DFS-Namespace

DFS Replication

FS-DFS-Replication

File Server Resource Manager

FS-Resource-Manager

Services for Network File System

FS-NFS-Services

Windows Search Service

FS-Search-Service

Windows Server 2003 File Services

FS-Win2003-Services

File Replication Service

FS-Replication

Indexing Service

FS-Indexing-Service

Hyper-V™ command identifiers Command value

Hyper-V™

Hyper-V

Network Policy and Access Services command identifiers Command value Notes

Network Policy and Access Services

NPAS

Because Network Policy and Access Services settings can be configured after installing the role, you are not required to specify Network Policy and Access Services settings in the command-line answer file.

Network Policy Server

NPAS-Policy-Server

NPAS Routing and Remote Access Services

NPAS-RRAS-Services

Remote Access Service

NPAS-RRAS

Routing

NPAS-Routing

Health Registration Authority

NPAS-Health

Print Services command identifiers Command value Notes

Print Services

Print-Server

During removal of this role in the Server Manager UI, you are prompted to delete instances of printers configured on the server. By default, these instances are preserved, which is the default behavior of command-line removal of the Print Services role.

Print Server

Print-Services

Internet Printing

Print-Internet

LPD Service

Print-LPD-Service

Terminal Services command identifiers Command value Notes

Terminal Services

Terminal-Services

Because Terminal Services settings can be configured after installing the role, you are not required to specify Terminal Services settings in the command-line answer file.

Terminal Server

TS-Terminal-Server

TS Licensing

TS-Licensing

TS Gateway

TS-Gateway

TS Web Access

TS-Web-Access

TS Session Broker

TS-Session-Broker

UDDI Services command identifiers Command value Notes

UDDI Services

UDDI Services is not installable by using the Server Manager command line.

You cannot install UDDI Services by using the Server Manager command-line because complex database settings are required during UDDI Services setup.

UDDI Services Web Application

UDDI Services Database

Web Server (IIS) command identifiers Command value Notes

Web Server (IIS)

Web-Server

None

Internet Information Services

Web-WebServer

 

Common HTTP Features

Web-Common-Http

 

Static Content

Web-Static-Content

 

Default Document

Web-Default-Doc

 

Directory Browsing

Web-Dir-Browsing

 

HTTP Errors

Web-Http-Errors

 

HTTP Redirection

Web-Http-Redirect

 

Application Development

Web-App-Development

 

ASP.NET

Web-Asp-Net

 

.NET Extensibility

Web-Net-Ext

 

ASP

Web-ASP

 

CGI

Web-CGI

 

ISAPI Extensions

Web-ISAPI-Ext

 

ISAPI Filters

Web-ISAPI-Filter

 

Server Side Includes

Web-Includes

 

Health and Diagnostics

Web-Health

 

HTTP Logging

Web-Http-Logging

 

Logging Tools

Web-Log-Libraries

 

Request Monitor

Web-Request-Monitor

 

Tracing

Web-Http-Tracing

 

Custom Logging

Web-Custom-Logging

 

ODBC Logging

Web-ODBC-Logging

 

Security

Web-Security

 

Basic Authentication

Web-Basic-Auth

 

Windows Authentication

Web-Windows-Auth

 

Digest Authentication

Web-Digest-Auth

 

Client Certificate Mapping Authentication

Web-Client-Auth

 

IIS Client Certificate Mapping Authentication

Web-Cert-Auth

 

URL Authorization

Web-Url-Auth

 

Request Filtering

Web-Filtering

 

IP and Domain Restrictions

Web-IP-Security

 

Performance

Web-Performance

 

Static Content Compression

Web-Stat-Compression

 

Dynamic Content Compression

Web-Dyn-Compression

 

Management Tools

Web-Mgmt-Tools

 

IIS Management Console

Web-Mgmt-Console

 

IIS Management Scripts and Tools

Web-Scripting-Tools

 

Management Service

Web-Mgmt-Service

 

IIS 6 Management Compatibility

Web-Mgmt-Compat

 

IIS 6 Metabase Compatibility

Web-Metabase

 

IIS 6 WMI Compatibility

Web-WMI

 

IIS 6 Scripting Tools

Web-Lgcy-Scripting

 

IIS 6 Management Console

Web-Lgcy-Mgmt-Console

 

FTP Publishing Service

Web-Ftp-Publishing

 

FTP Server

Web-Ftp-Server

 

FTP Management Console

Web-Ftp-Mgmt-Console

 
Windows Deployment Services command identifiers Command value Notes

Windows Deployment Services

WDS

None

Feature command identifiers

Features Command Value Notes

BitLocker Drive Encryption

BitLocker

 

BITS Server Extensions

BITS

 

Connection Manager Administration Kit

CMAK

 

Desktop Experience

Desktop-Experience

 

Failover Clustering

Failover-Clustering

 

File Server Resource Manager

Resource-Manager

File Server Resource Manager is available as a feature only on the Windows Server 2008 Web Server edition. On other Windows Server 2008 SKUs, File Server Resource Manager is a role service of File Services.

Group Policy Management

GPMC

 

Internet Printing Client

Internet-Print-Client

 

Internet Storage Naming Server

ISNS

 

LPR Port Monitor

LPR-Port-Monitor

 

Message Queuing

MSMQ

 
  • Message Queuing Services

MSMQ-Services

  • Message Queuing Server

MSMQ-Server

  • Directory Service Integration

MSMQ-Directory

  • Message Queuing Triggers

MSMQ-Triggers

  • HTTP Support

MSMQ-HTTP-Support

  • Multicasting Support

MSMQ-Multicasting

  • Routing Service

MSMQ-Routing

  • Windows 2000 Client Support

MSMQ-Win2000

  • Messaging Queue DCOM Proxy

MSMQ-DCOM

Multipath I/O

Multipath-IO

 

Network Load Balancing

NLB

 

.NET Framework 3.0 Features

NET-Framework

Note that the command-line syntax for .NET Framework 3.0 Features does not contain the "." character before NET.

  • .NET Framework 3.0

NET-Framework-Core

  • XPS Viewer

NET-XPS-Viewer

  • Windows Communication Foundation Activation Components

NET-Win-CFAC

  • HTTP Activation

NET-HTTP-Activation

  • Non-HTTP Activation

NET-Non-HTTP-Activ

Peer Name Resolution Protocol

PNRP

 

Quality Windows Audio Video Experience

Qwave

 

Remote Assistance

Remote-Assistance

 

Remote Differential Compression

RDC

 

Removable Storage Manager

Removable-Storage

 

RPC over HTTP Proxy

RPC-over-HTTP-Proxy

 

Remote Server Administration Tools

RSAT

  • Role administration tools

RSAT-Role-Tools

  • Active Directory Certificate Services Tools

RSAT-ADCS

  • Active Directory Domain Services Tools

RSAT-ADDS

  • Active Directory Domain Controller Tools

RSAT-ADDC

  • Server for NIS Tools

RSAT-SNIS

  • Active Directory Lightweight Directory Services Tools

RSAT-ADLDS

  • Active Directory Rights Management Services (AD RMS) Tools

RSAT-RMS

  • DHCP Server Tools

RSAT-DHCP

  • DNS Server Tools

RSAT-DNS

 
  • Fax Server Tools

RSAT-Fax

  • DFS Management Console Tools

RSAT-DFS-Mgnt-Con

 
  • File Server Resource Manager Management Console Tools

RSAT-FSRM-Mgnt

 
  • Hyper-V Tools

RSAT-Hyper-V

 
  • Services for Network File System Tools

RSAT-NFS-Admin

 
  • File Services Tools

RSAT-File-Services

 
  • Network Policy and Access Services Tools

RSAT-NPAS

 
  • Health Registration Authority Tools

RSAT-HRA

 
  • Network Policy Server Tools

RSAT-NPS

 
  • Print Services Tools

RSAT-Print-Services

 
  • Web Server (IIS) Tools

RSAT-Web-Server

 
  • Terminal Services Tools

RSAT-TS

 
  • TS RemoteApp Tools

RSAT-TS-RemoteApp

  • TS Gateway Tools

RSAT-TS-Gateway

 
  • TS Licensing Tools

RSAT-TS-Licensing

 
  • UDDI Services Tools

RSAT-UDDI

 

Remote Server Administration Tools feature administration tools

RSAT-Feature-Tools

 
  • BitLocker Drive Encryption Tools

RSAT-BitLocker

 
  • BITS Server Extensions Tools

RSAT-BITS-Server

 
  • Failover Clustering Tools

RSAT-Clustering

 
  • Network Load Balancing Tools

RSAT-NLB

 
  • SMTP Server Tools

RSAT-SMTP

 
  • Windows Deployment Services Tools

RSAT-WDS

 
  • WINS Server Tools

RSAT-WINS

 

Services for Network File System

NFS-Services

Services for Network File System is available as a feature only on the Windows Server 2008 IA64 version. On other versions of Windows Server 2008, it is available as a role service of File Services.

Simple TCP/IP Services

Simple-TCPIP

 

SMTP Server

SMTP-Server

 

SNMP Services

SNMP-Services

 
  • SNMP Service

SNMP-Service

  • SNMP WMI Provider

SNMP-WMI-Provider

Storage Manager for SANs

Storage-Mgr-SANS

 

Subsystem for UNIX-based Applications

Subsystem-UNIX-Apps

 

Telnet Client

Telnet-Client

 

Telnet Server

Telnet-Server

 

TFTP Client

TFTP-Client

 

Windows Internal Database

Windows-Internal-DB

 

Windows PowerShell

PowerShell

 

Windows Process Activation Service

WAS

 
  • Process Model

WAS-Process-Model

  • .NET Environment

WAS-NET-Environment

  • Configuration APIs

WAS-Config-APIs

Windows Server Backup Features

Backup-Features

 
  • Windows Server Backup

Backup

  • Command-line tools

Backup-Tools

  • Windows Server Backup Cmdlets

Backup-Cmdlets

Windows System Resource Manager

WSRM

 

WINS Server

WINS-Server

 

Wireless Networking

Wireless-Networking

 

Remarks

ServerManagerCmd.exe does not support configuration or management of roles and features, after those are installed. Role and feature installations completed by using ServerManagerCmd.exe use default settings. To modify role or feature settings, perform role administration tasks, or view status or events for roles and features, you should use the Windows GUI–based Server Manager console. You might need to open other management snap-ins for your role, or use role- and feature-specific command-line tools for managing or configuring specific roles, role services, and features.

Note

Although role and feature installations are secure by default, you should use the Server Manager console to modify any default settings to conform to security policies in your enterprise. ServerManagerCmd.exe cannot be used to install and configure applications other than Windows Server 2008 roles, role services, and features. ServerManagerCmd.exe is not supported on computers running a Server Core installation of Windows Server 2008. ServerManagerCmd.exe cannot be used for installation or removal of roles, role services, and features on remote computers.

Examples

The following are examples of how Server Manager commands are used.

Querying the installed roles and features on the computer

The following example shows the ServerManagerCmd.exe syntax for performing a query to determine which roles, role services, and features are installed on a computer, and which are available for installation. In this example, the administrator directs Server Manager to save the results of the query to a file, C:\queryResults.xml.

ServerManagerCmd.exe -query C:\queryResults.xml

Installing a role without an answer file

The following shows the ServerManagerCmd.exe syntax for installing Web Server (IIS) and all its role services. The administrator exports the results of the installation to an XML file called WebServer.xml. The administrator has also instructed Server Manager to restart the computer automatically when installation is complete, if required by the role.

ServerManagerCmd.exe -install Web-Server -allSubFeatures -resultPath C:\Admin\WebServer.xml -restart

Removing features by using an answer file and the ServerManagerCmd.exe command

An administrator is using the following command to repurpose several servers by removing a number of roles. Commands for the roles to be removed are provided in an answer file named RemoveFilePrint.xml. The administrator has added the -whatIf option to the command to display the command operations specified in the removalresults.xml answer file, and show if any software that is dependent on the items specified for removal in the answer file was also removed.

ServerManagerCmd.exe -inputPath C:\AdminFiles\RemoveFilePrint.xml -resultPath C:\AdminFiles\removalresults.xml -whatIf

Additional references

Windows Script Center (https://go.microsoft.com/fwlink/?LinkID=63080)

Interpreting Output from Server Manager Commands