AppCmd.exe
IIS 7 command-line tool used to perform common IIS administrative tasks such as creating new sites, stopping/starting services, and viewing status of the site.
appcmd (command) (object-type) <identifier> </parameter1:value1 ...>
In order to run AppCmd.exe
, you will either need to change directory into %windir%\system32\inetsrv\
or add it to your PATH
variable. On a Windows 2008 server with a default installation, AppCmd.exe
is located in C:\Windows\System32\inetsrv
.
Supported object types:
SITE
Administration of virtual sitesAPP
Administration of applicationsVDIR
Administration of virtual directoriesAPPPOOL
Administration of application poolsCONFIG
Administration of general configuration sectionsWP
Administration of worker processesREQUEST
Administration of HTTP requestsMODULE
Administration of server modulesBACKUP
Administration of server configuration backupsTRACE
Working with failed request trace logs
General parameters:
/? Display context-sensitive help message.
/text<:value> Generate output in text format (default).
/text:* shows all object properties in detail view.
/text:<attribute> shows the value of the specified
attribute for each object.
/xml Generate output in XML format.
Use this to produce output that can be sent to another
command running in /in mode.
/in or - Read and operate on XML input from standard input.
Use this to operate on input produced by another
command running in /xml mode.
/config<:*> Show configuration for displayed objects.
/config:* also includes inherited configuration.
/metadata Show configuration metadata when displaying configuration.
/commit Set config path where configuration changes are saved.
Can specify either a specific configuration path, "site",
"app", "parent", or "url" to save to the appropriate portion
of the path being edited by the command, "apphost", "webroot",
or "machine" for the corresponding configuration level.
/debug Show debugging information for command execution.
Use
!
to escape parameters that have same names as the general parameters, like/!debug:value
to set a config property nameddebug
.
List all sites:
appcmd list sites
List started sites:
appcmd list sites /state:started
List stopped sites:
appcmd list sites /state:stopped
List unknown sites:
appcmd list sites /state:stopped
Start a site:
appcmd start sites "Default Web Site"
Stop a site:
appcmd stop sites "Default Web Site"
appcmd add site /name:mywebsite /id:99 /bindings:http/*:81: /physicalPath:C:\mywebsite
List all backup configurations:
appcmd list backup
Show site configuration:
appcmd list site "Default Web Site" /config
Author
- Jon LaBelle, [email protected]
Resources