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

About: Mike

Milind Koyande loves to work on new technologies specially virtualization and troubleshoot server problems. I’m an avid photographer and love to spend my free time close to nature, trying to capture its glory on my camera.

2 thoughts on “Command Line installation of Roles (ServerManagerCmd.exe) in Windows 2008”

This site uses Akismet to reduce spam. Learn how your comment data is processed.