AppCmd introduction and examples

The AppCmd command is your one-stop-shop for administering Windows Server IIS web servers. In combination with WinRM it’s your Swiss Army knife for your daily routine. This post introduces appcmd and provides you with a lot of helpful appcmd examples.

IIS server management with AppCmd

AppCmd.exe is a command-line utility to manage Windows Server IIS 7+ web servers. It exposes all important IIS server management functionality available through a set of intuitive management objects that can be manipulated through the cmd.exe or PowerShell command-line, or through PowerShell scripts. It provides the ability to administer and maintain Windows Server IIS editions without a graphical user interface (or GUI), like Windows Server Core for example. Using AppCmd you can administer those IIS servers without the need for writing extensive scripts.

On iis.net you’ll find the Getting started with AppCmd.exe, written by Mike Volodarsky, who also created the AppCmd tool.

Some tasks you can use AppCmd for are:

  • Create and configure websites, applications, application pools and IIS virtual directories.
  • Starting and stopping of sites, and recycling application pools.
  • List currently running worker processes and examine currently executing requests
  • Search, manipulate (add, edit, clear / remove), import/export IIS and ASP.NET configurations.

In this AppCmd introduction post I’ll show you AppCmd examples to administer Internet Information Services (IIS).

AppCmd usage and AppCmd command examples

AppCmd uses the following syntaxis for its commands: AppCmd (command) (object-type) <identifier> </parameter1:value1 ...>

Some of AppCmd commands are list, set, add, delete, start and stop. Those commands are used for the following object-types: site, app (application), vdir (virtual directory), apppool (application pool), config, wp (worker process), request, module, backup, trace and binding. Of course not every object-type can be stopped or started, look up the available options using /?:

AppCmd /?
AppCmd site /?
AppCmd config /?
AppCmd list apppool /?

Now let’s dive into AppCmd with some examples! :-)

List website information

Appcmd list site "Default Web Site"

This command provides some valuable information about the requested website, the Default Web Site in this case. Its output is:

SITE "Default Web Site" (id:1,bindings:http (function() { var dropdown = document.getElementById( "archives-dropdown-5" ); function onSelectChange() { if ( dropdown.options[ dropdown.selectedIndex ].value !== '' ) { document.location.href = this.options[ this.selectedIndex ].value; } } dropdown.onchange = onSelectChange; })();   

    Loading time: 105 queries, 0.252 seconds using 13738472 bytes memory. Peak memory usage: 14576048 bytes.