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

By: Published: Dec 14th, 2012 Category: Microsoft Windows

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


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.

Tags: , , ,

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

  1. Office 2011 Mac Serial
    on May 19th, 2012
    @ 2:26 am

    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. Milind
    on Jun 5th, 2012
    @ 6:17 am

    Thanks for your kind words…

Leave a Reply

Subscribe to eITWebguru

© 2012 eITWebguru. All Rights Reserved.