APPCMD: Manage IIS from the Command Line

APPCMD: Manage IIS from the Command Line

AppCmd.exe is the single command-line tool for managing IIS 7+. It exposes all key server management functionality through a set of intuitive management objects that can be manipulated from the command line or from scripts.

AppCmd enables you to easily control the server without using a graphical administration tool and to quickly automate server management tasks without writing code.

Getting started with APPCMD

AppCmd.exe is located in the %systemroot%\system32\inetsrv\ directory which is not path, so you will have to use the full path to executable or add the inetsrv directory to the path of your machine.

So, first let’s cd into the directory where AppCmd.exe file is located:

cd %systemroot%\system32\inetsrv\
Getting started with APPCMD

cd into the directory where AppCmd.exe file is located

NOTE: You need to make sure that you run AppCmd.exe from an elevated command prompt since otherwise, you will not be running as Administrator, and will receive an error message as the one on the screenshot below:

APPCMD Syntax

The APPCMD tool works by executing a command on one of the supported management objects, with optional parameters used to further customize the behavior of the command:

APPCMD (command) (object-type) <identifier> < /parameter1:value1 ... >*

Commands

Most objects support this basic set of commands:

  • LIST Display the objects on the machine. An optional <ID> can specify a unique object to list, or one or more parameters can be specified to match against object properties.
  • ADD Create a new object with the specified object properties to set during creation.
  • DELETE Delete the object specified by the <ID>.
  • SET Set parameters on the object specified by <ID>.
  • START / STOP Supported only for the Site object, can also be specified by the <ID>.

Objects

The current set of objects available through AppCmd is (where <OBJECT> is one of the management objects supported by the tool):

ObjectDescription
SiteAdministration of virtual sites
AppAdministration of applications
VDirAdministration of virtual directories
ApppoolAdministration of application pools
ConfigAdministration of general configuration sections
BackupManagement of server configuration backups
WPAdministration of worker processes
RequestDisplay of active HTTP requests
ModuleAdministration of server modules
TraceManagement of server trace logs

APPCMD CheatSheet

Make sure to check out the AppCmd CheatSheet that demonstrates the syntax and shows the most used snippets that can save you the time by not having to use the IIS GUI.

Written by
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.