Microsoft Windows

Command Line installation of Roles (ServerManagerCmd.exe) in Windows 2008

In Windows 2008 Components like IIS, DNS etc. are called as Roles and you can add these Roles from Server Manager >> Roles >> Add Roles and then you have to follow the steps to install the desire components. This process is a bit lengthly as you will have to go through the steps. You can automate and eliminate these steps by using Command Line utility called “ServerManagerCmd.exe”.

ServerManagerCmd.exe is a tool or command which Installs and removes roles, role services and features. Also displays the list of all roles, role services, and features available, and shows which are installed on this computer.

Switch Parameters:
-help | -?


“-query” parameter is used to see all the available and installed ROLES of components on the server. The installed modules are are shown in Green Color (which can bee seen in below image)

C:\>servermanagercmd -query


Install ROLES

To add additional roles to the server, “-install” or “-i” parameter is used. You can install a ROLE by using “-i” which will install all the components which are required by the component.

C:\>servermanagercmd -i Web-Server


Also you can mentioned all the Components separating them with SPACE which will install all the modules you have listed (it will save time)

C:\>servermanagercmd -i Web-Asp-Net Web-Net-Ext Web-ASP Web-CGI Web-ISAPI-Ext Web-ISAPI-Filter Web-Includes Web-Http-Logging Web-Custom-Logging


You can find more information about the ROLES and “Command value” (Component name) on Microsoft Technet Website

Remove ROLES

Roles which are already installed on the server can be removed with the help of “-remove” parameter. Using this, complete ROLE and it’s dependencies will be un-installed from the server.

C:\>servermanagercmd -remove Web-Server


Additional Options

This parameter is used to check the ServerManager version

-help or -?
Display Help for ServerManagerCmd.exe in the command window.

C:\>servermanagercmd -version
C:\>servermanagercmd -?


NOTE: There are some roles which requires Reboot after installation or removal, in such cases you can add “-restart” at the end of install or remove option. This will reboot the server after completion of task if required.

C:\>servermanagercmd -i Web-Server -restart
C:\>servermanagercmd -remove Web-Server -restart


  1. Woah this blog is excellent i love studying your posts. Keep up the good work! You realize, many individuals are hunting around for this info, you can help them greatly.

  2. Thanks for your kind words…

Leave a Reply