Main Content

ServerManagerCmd basics

While Microsoft server provides a great wizard to manipulate roles and features, you may be also interested in learning about it’s command-line counterpart ServermManagerCmd.exe. The command line oriented tool can be used to determine/install/uninstall roles, role services, and features.

ServerManagerCmd requires an elevated command prompt

Query the system

ServerManagerCmd is easy to lean and use. Let’s start by finding out which roles, role services, and features are installed on a system.

In the Windows command-line prompt type.

servermanagercmd -query > queryresults.txt
  • What this command does is query the system and print the results to a text file.
  • If you wish to can change the file extension from .txt to .xml, XML allows for the file to be used in conjunction with automation techniques.

ServerManagerCmd

Component installation

Using ServerManagerCmd to install components could not be easier, just use -install in front of servermanagercmd to indicate you wish to install a component.

In the Windows command-line prompt type.

servermanagercmd -install fs-fileserver -allsubfeatures
  • Notice the -allsubfeatures, what this does is install any other sub-feature required by the installation.

severmanager_install

For a complete list of components you should take a look at this page.

Component uninstallation

To uninstall or remove a component the process is almost the same as the installation, just use -remove to indicate you wish to remove a component.

In the Windows command-line type.

servermanagercmd -remove fs-fileserver -allsubfeatures
  • Notice the -allsubfeatures will also uninstall any subfeature required by the installation

servermanager_remove