Streamlining Functionality in IIS 7.0 with AppCmd.exe

Among the many improvements to Internet Information Services 7.0 (IIS 7.0) is the brand new command line tool: AppCmd.exe. AppCmd.exe has streamlined the functionality previously available from a set of vbs files in IIS 6.0. The result is a comprehensive tool to quickly automate many web server administration tasks from the command line and other applications.

AppCmd.exe comes equipped with the power to create, configure and perform tasks with sites, applications, virtual directories and application pools. This is made possible with a set of objects, commands and parameters. AppCmd.exe provides administrators with the flexibility to quickly change a several settings in IIS by running a couple of commands as opposed to using the IIS manager. It also has the power to change settings on multiple objects simultaneously; this would normally require setting them one at a time using the IIS manager. You can create batch files for performing common administrative tasks, and you can even use AppCmd.exe with the new Windows PowerShell to integrate even more power in your administration scripts.

To help you gain a better understanding of the potential applications of this powerful new command line tool, I will go over the following tasks:

  • Using AppCmd.exe’s objects and commands
  • Using the LIST command
  • Using the BACKUP object
  • Using the CONFIG object

Using AppCmd.exe’s Objects and Commands

The commands available to AppCmd.exe are utilized with the syntax below:

appcmd.exe <COMMAND> <OBJECT> <ID> [ /parameter:value ]  

Each object has a set of commands available to them, which in turn support a set of parameters. The ID specifies a particular object such as a certain site or application pool. Currently AppCmd.exe has the following objects available at its disposal:

  • SITE – Exposes commands available to a web site
  • APP – Exposes commands available to an application
  • VDIR – Exposes commands available to a virtual directory
  • APPPOOL – Exposes commands available to an application pool
  • CONFIG – Exposes general IIS configuration commands
  • BACKUP – Exposes commands for server configuration backups
  • WP – Exposes commands for managing worker processes
  • REQUEST – Used to display active HTTP requests
  • MODULE – Exposes commands available to server modules
  • TRACE – Exposes commands for managing server trace logs

Most objects support the LIST, ADD, DELETE and SET commands. Other commands available to each object vary from object to object, such as the START and STOP commands for a site object. You can get help on appcmd.exe, objects and commands by ending the command with /?.

For example, these commands can all be used to get help:

appcmd.exe /?  appcmd.exe site /?  appcmd.exe start site /?  

Using the LIST Command

The objects available to AppCmd.exe can sometimes be used in both singular and plural form when executing commands or setting parameters. This is particularly useful when using the LIST command, where you can list all instances of an object. The command below is used to list all the web sites on the web server:

appcmd.exe list sites /serverAutoStart:true  

You can also list objects that meet a certain criteria by specifying one or more parameters to match. The command below will list all web sites that are set to start automatically on the web server:

appcmd.exe list site "Default Web Site"  

You can list a single object by specifying the ID of the object. The command below will list the information for a single site by specifying its name:

SITE "Default Web Site" (id:1,bindings:HTTP/*:80:,state:Started)  

The output generated by running the command above depends on the settings of the site, below is an example of that output:

SITE "Default Web Site" (id:1,bindings:HTTP/*:80:,state:Started)  

To provide detailed or specific information, you can use the LIST command with the /text:<PROPERTY> parameter, which lists all properties in a hierarchical tree format. You can also use the property name listed in the command below to display information for a specific property:

appcmd.exe list site "Default Web Site" /text:state  

Using the BACKUP Object

The BACKUP object is used for the creation or restoration of the global server configuration. This includes the applicationHost.config and other server-wide state settings. If you backup before making changes to the server’s configuration, you could use the backup to recover the previous settings should you have the need. When creating a backup with AppCmd.exe you can have the name automatically generated or provide a name with the commands below:

appcmd.exe add backup  appcmd.exe add backup IISBackup  

The automatically generated name of a backup will represent the date and time the backup was created such as 20070830T172525. When created, the backup files are stored to %windir%System32InetsrvBackup, where %windir% is the location of the Windows directory on the system. You can restore a backup with this command:

appcmd.exe restore backup "IISBackup"  

Using the CONFIG Object

Internet Information Server 7.0 now has an XML-based configuration system. XML is designed to be human readable so you could view and edit the files directly in any text editor; however, AppCmd.exe makes is useful for preventing any invalid syntax in the XML by allowing you to edit one configuration at a time. The CONFIG object can use these commands:

  • LIST for viewing configuration information
  • SET for editing a configuration value
  • LOCK and UNLOCK for preventing configurations from being overridden at lower levels
  • SEARCH for finding configuration file locations

You can view a file using AppCmd.exe with the LIST command like in the example below, which displays the server-level configuration:

appcmd.exe list config  

You can also provide a URL to specify a site or application’s configuration file, as shown here:

appcmd.exe list config "Default Web Site/SiteApplication/"  

The URL can be the HTTP URL or simply the path using the site name and application name in IIS. By default, listing a configuration file will only display values explicitly set without default or inherited values. You can also provide parameters such as /section:<SECTION> and/or /config:* to the end of the command. Using the /section:asp parameter allows you to view the asp section of a configuration file. The /config:* parameter can be used to display all configuration settings including the default and inherited values.

The SET command is used with the CONFIG object to change configuration values. The SET command uses the same path notation and the /section:<SECTION> parameter to specify the configuration section to edit. You then specify the property name to change with the value to set it to after the colon. Nested properties are separated by a period in the properties parameter as can be seen below:

appcmd.exe set config "Default Web Site/SiteApplication" /section:asp    /limits.requestQueueMax:1000  

Many of IIS’s configuration sections are locked at the server level by default. Using the commands below will lock and unlock the asp section of the server’s configuration:

appcmd.exe lock config /section:asp  appcmd.exe unlock config /section:asp  

When using the SEARCH command with the CONFIG object, it’s possible to search for all configuration locations or narrow down the search to locations with particular sections, properties, and values. The first argument specifies the URL of the site or application and it is optional. The commands below display the possible uses from displaying all configuration locations:

appcmd.exe search config  appcmd.exe search config "Default Web Site/"  appcmd.exe search config "Default Web Site/" /section:directoryBrowse  appcmd.exe search config "Default Web Site/" /section:directoryBrowse /enabled  appcmd.exe search config "Default Web Site/" /section:directoryBrowse /enabled:true  

Train Signal’s Microsoft Windows IIS Web Server Training

Learn how to setup and administer a web server with Train Signal’s Microsoft Windows IIS Web Server training for Windows Server 2000 and 2003!


  • Learn how to set up a Windows IIS Web Server by watching it configured on a live network!
  • You get 8+ hours of instructor-led training videos
  • 70+ page IIS Web Server “how to” guide
  • Interactive scenarios and real-world examples taught by an experienced MCSE

View the Microsoft Windows IIS Web Server training demo here!

 in IIS


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