Installing IIS 7.0 using ServerManagerCmd.exe

ServerManagerCmd.exe is the new command line tool to install IIS on a Longhorn Server machine. The new tool makes easy to automate install tasks so that IIS and other roles/features can be installed on a longhorn server machine easily in scriptable manner.

 

ServerManagerCmd.exe comes with distinct advantages with respect to other command-line install tools available on longhorn server (i.e. pkgmgr.exe, ocsetup.exe). The top advantages could be summarized as:

1.       “–Query” switch enables querying available roles and features. It can also provide information on what’s currently installed on the machine (see below for example).

2.       “-WhatIf” switch will provide what would be installed without installing anything on the box. This could be useful determining what dependencies will get installed for particular role or features if chosen (see below for example).

3.       Automatic detection of dependencies and installing them without explicitly passing to the tool as command-line arguments.  

 

IIS7 make good use of componentized architecture and enable system administrators to select and install only needed features on the box. Currently IIS7 provides around 40 installable features for longhorn server editions. The goal of this blog to summarize some common install scenarios and provide simple answer files to install them using ServerManagerCmd.exe

 

As far as how to use ServerManagerCmd.exe, it is really easy. Please make sure that you have administrator privileges on the box before you start. As a warm-up, you can type following commands on command shell to see the info tool provides.

  • ServerManagerCmd.exe -help: This will show help information and available switches for the command-line tool. (Short form: -?)
  • ServerManagerCmd.exe -query: Display a list of all roles, role services, and features available and shows which are installed on this computer. (Short form: -q)
  • ServerManagerCmd.exe -install <Available Role/Feature Name> -whatif: Display the operations to be performed on the current computer that are specified (Short form: -w)
  • ServerManagerCmd.exe -inputPath <answer.xml>: Installs or removes the roles, role services, and features specified in an XML answer file, the path and name of which is represent by <answer.xml>. (ShortForm: -ip)

Common IIS Install Scenarios

For simplicity, we provide common IIS install options using an answer file (simple XML file format that ServerManagerCmd.exe accepts as input). Without further delay, let's start...

 

1. Static Content Web Server Install Scenario (a.k.a. Default IIS install)

Save following content as Default.xml in your local disk.

 

<ServerManagerConfiguration Action="Install" xmlns="http://schemas.microsoft.com/sdm/Windows/ServerManager/Configuration/2007/1">
        <Role Id="Web-Server" />
      </ServerManagerConfiguration>
 
    Run following on command-line: ServerManagerCmd.exe -inputPath Default.xml

 

2. Default IIS + FastCGI Install Scenario

Save the following content as Default_CGI.xml in your local hard disk.

 

   <ServerManagerConfiguration Action="Install" xmlns="http://schemas.microsoft.com/sdm/Windows/ServerManager/Configuration/2007/1">
      <Role Id="Web-Server" />
      <RoleService Id="Web-CGI" />
 </ServerManagerConfiguration>

 

Run following on command-line: ServerManagerCmd.exe -inputPath Default_CGI.xml

 

3. Default IIS + Classic ASP Install Scenario

Save the following content as Default_ASP.xml in your local hard disk.

 

<ServerManagerConfiguration Action="Install" xmlns="http://schemas.microsoft.com/sdm/Windows/ServerManager/Configuration/2007/1">

    <Role Id="Web-Server" />
    <RoleService Id="Web-ASP" />
    <RoleService Id="Web-Filtering" />
    <RoleService Id="Web-ISAPI-Ext" />
</ServerManagerConfiguration>

 

Run following on command-line: ServerManagerCmd.exe -inputPath Default_ASP.xml

 

 

4. Default IIS + ASP.Net Install Scenario

Save the following content as Default_ASPNET.xml in your local hard disk. 

 

<ServerManagerConfiguration Action="Install" xmlns="http://schemas.microsoft.com/sdm/Windows/ServerManager/Configuration/2007/1">

    <Role Id="Web-Server" />
    <RoleService Id="Web-ASP-Net" />
    <RoleService Id="Web-Net-Ext" />
    <RoleService Id="Web-Filtering" />
    <RoleService Id="Web-ISAPI-Filter" />
    <RoleService Id="Web-ISAPI-Ext" />
</ServerManagerConfiguration>
 

Run following on command-line: ServerManagerCmd.exe -inputPath Default_ASPNET.xml

 

5. FTP Publishing Scenario

Save the following content as Default_FTP.xml in your local hard disk. 

 

<ServerManagerConfiguration Action="Install" xmlns="http://schemas.microsoft.com/sdm/Windows/ServerManager/Configuration/2007/1">

    <Role Id="Web-Server" />
    <RoleService Id="Web-Ftp-Server" />
    <RoleService Id="Web-Ftp-Mgmt-Console" />
</ServerManagerConfiguration>

 

Run following on command-line: ServerManagerCmd.exe -inputPath Default_FTP.xml

 

6. Default IIS + Metabase Compatibility Install Scenario

Save the following content as Default_Compat.xml in your local hard disk 

 

<ServerManagerConfiguration Action="Install" xmlns="http://schemas.microsoft.com/sdm/Windows/ServerManager/Configuration/2007/1">

    <Role Id="Web-Server" />
    <RoleService Id="Web-Metabase" />
    <RoleService Id="Web-WMI" />
    <RoleService Id="Web-Lgcy-Scripting" />
</ServerManagerConfiguration>

 

Run following on command-line: ServerManagerCmd.exe -inputPath Default_Compat.xml

 

7. Full IIS Install Scenario

Save the following content as Full_IIS.xml in your local hard disk 

 

<ServerManagerConfiguration Action="Install" xmlns="http://schemas.microsoft.com/sdm/Windows/ServerManager/Configuration/2007/1">

    <Role Id="Web-Server" InstallAllSubFeatures="true" />
</ServerManagerConfiguration>
 
Run following on command-line: ServerManagerCmd.exe -inputPath Full_IIS.xml
 
 
Uninstalling IIS
In all IIS install scenarios described above, following command can be used to uninstall IIS features from a longhorn server machine.
 
ServerManagerCmd.exe -remove Web-Server
 
Additional Information
  1. ServerManagerCmd.exe is only available on Longhorn Server Edition of Windows. It is not available on Vista SKUs or previous releases of Windows operating system.
  2. ServerManagerCmd.exe is a managed code application.
  3. ServerManagerCmd.exe application is located under %WinDir%\system32 path.

 

3 Comments

  • great post, I'll be referring to it often! :) welcome to blogsphere -

  • Check additional details about the roles available via Server Manager and ServerManagerCmd in Windows Server 2008 at

    http://blogs.technet.com/josebda/archive/2007/07/25/changes-in-windows-server-2008-roles-and-features-from-the-beta-3-to-the-june-ctp.aspx

  • If this command "servermanagercmd -query iis.xml" generates an XML file, why is it not in a format that we can use to add or remove features? Like "servermanagercmd -install iis.xml" or "servermanagercmd -remove iis.xml"?

Comments have been disabled for this content.