Servermanagercmd command in Windows

(Applies to Windows Server (Semi-Annual Channel), Windows Server 2016, Windows Server 2012 R2, Windows Server 2012)

(Applies to Windows Server (Semi-Annual Channel),Windows Server 2016, Windows Server 2012 R2,Windows Server 2012)

Note: This command is only available on servers that are running Windows Server 2008 or Windows Server 2008 R2. Servermanagercmd.exe is no longer used and will not be available in Windows Server 2012. For information on how to install or delete roles, role services and features in Windows Server 2012, please refer to the command post. This is on Microsoft TechNet.

Servermanagercmd command installs and removes roles, roles roles and features.It also allows to display a list of all roles, role services and available features and programs installed on this computer.

Syntax Servermanagercmd command

 servermanagercmd -query [[[:]]] [-logpath [[:]]] 
servermanagercmd -inputpath [[:]] [-resultpath [-restart] | -whatif] [-logpath [[:]]]
servermanagercmd -install [-allSubFeatures] [-resultpath [[:]] [-restart] | -whatif] [-logpath [[:]]]
servermanagercmd -remove [-resultpath [-restart] | -whatif] [-logpath [[:]]]
servermanagercmd [-help | -?]
servermanagercmd -version

Servermanagercmd command parameter

Parameters

Describe

-query [[[:]]]

Displays a list of all roles (roles), roles services (services and features that are installed or available for installation on the server. You can also use the shortened form of this parameter. is -q.If you want the query results to be saved to an XML file, specify an XML file to replace the default query.xml file.

-inputpath <[[:]] answer.xml>

Install or delete the roles, services roles and features specified in the XML query file (represented by an answer.xml file).In addition, you can also use the shortened form of this parameter as -p.

-install

Install the roles, services roles or features specified by the Id parameter.The identifiers will not be case sensitive.If you only specify the installation of multiple roles, services roles or features, they must be separated by spaces.The following optional parameters will be used together with the -install parameter:

- setting = : Specifies the settings that will be required during the installation process.

-allSubFeatures : Specify the installation of all sub-service roles and features next to the main roles, role service or features named in the Id value.

Note: Some areas contain a role without a command line identifier to allow installation of all services roles.This is the case when the services roles cannot be installed in the same version of Server Manager.For example: Federation Service role of an active Federation Services folder and role service Federation Service Proxy cannot be installed using the same Server Manager command

- resultpath: Save the installation results to the XML file represented by * result.xml. You can also use the short form of this parameter as -r. Note: You cannot run servermanagercmd with both the -resultpath parameter and the specified -whatif parameter.

-restart: Automatically restart the computer when the installation is complete (if restarting is required by installed roles or features).

-whatif: Displays any operation specified for the -install parameter. You can also use the shortened form of the -whatif parameter -w. Also, you cannot run servermanagercmd when both the -resultpath parameter and the same -whatif parameter are specified.

-logpath <[[:]] log.txt>: Specifies the name and location for the log file next to the default location% Windir% tempservermanager.log.

-Remove

Delete the roles, services roles or features specified by the Id parameter.The identifiers will not be case sensitive.If you only specify the installation of multiple roles, services roles or features, they must be separated by spaces.The following optional parameters will be used together with the -remove parameter:

-resultpath <[[:]] result.xml>: Save the results deleted to the XML file represented by the result.xml file. You can also use the shortened form of this parameter as -r. Note: You cannot run servermanagercmd when both the -resultpath parameter and the same -whatif parameter are specified.

-restart: Automatically restart the computer when the deletion process is completed (if restarting is required by the remaining roles or features).

-whatif: Displays any operation specified for the -remove parameter. You can also use the shortened form of the -whatif parameter -w. Note, you will not be able to run servermanagercmd when both the -resultpath and -whatif parameters are specified.

-logpath <[[:]] log.txt>: Specifies the name and location for the log file next to the default location% Windir% tempservermanager.log.

-help

Show help at thecommand prompt.You can also use the shortened form of this parameter as - ?.

-version

Displays the version number of Server Manager server manager.You can also use the shortened form of this parameter as -v.

Note Servermanagercmd command

The Servermanagercmd command is no longer used and is not guaranteed to be supported in future Windows releases. We recommend that if you are running Server Manager server manager on computers running Windows Server 2008 R2, you should use the Windows PowerShell cmdlets available for Server Manager. For more information on these commands, see the articles about Windows PowerShell cmdlets for Server Manager on Microsoft technet. In addition, the Servermanagercmd command can be launched from any directory on the server's local drives and you must be a member of the administrator group on the server on which you want to install or delete the software.

Attention:

Due to security restrictions applied by User Account Control in Windows Server 2008 R2, you must run the Servermanagercmd command in the Command prompt window opened with administrator privileges.To do this, right-click the executable file of the Command prompt or the Command prompt logo on the Start menu, then click the Run as administrator option.

Example Servermanagercmd command

The following example demonstrates how to use servermanagercmd to display a list of all roles, services roles and available features, as well as roles, services roles and features installed on the computer.

 servermanagercmd -query 

The following example shows how to use the servermanagercmd command to install the Web Server (IIS) role and save the installation results to the XML file represented by installResult.xml.

 servermanagercmd -install Web-Server -resultpath installResult.xml 

The following example shows how to use the ** whatif ** parameter with the command servermanagercmd to display details about the roles, services roles and features that will be installed or deleted, based on the instructions indicated. specified in the XML query file presented by the install.xml file:

 servermanagercmd -inputpath install.xml -whatif 

See more:

  1. Summary of 20 common Run commands on Windows operating system
  2. Summary of shortcuts to know in Windows 10
  3. Basic Linux commands everyone needs to know
  4. Table summarizes the basic PowerShell commands
Update 26 May 2019
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile