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:
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:
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 ... >*
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>.
The current set of objects available through AppCmd is (where
<OBJECT> is one of the management objects supported by the tool):
|Administration of virtual sites
|Administration of applications
|Administration of virtual directories
|Administration of application pools
|Administration of general configuration sections
|Management of server configuration backups
|Administration of worker processes
|Display of active HTTP requests
|Administration of server modules
|Management of server trace logs
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.