The IIS 7 configuration system contains 50+ configuration sections, 477 attributes, and 57 collections.
Listing Objects
The LIST command is the most versatile command in APPCMD, and is supported by all objects.
List all websites
APPCMD list sites
List all websites that are not running
APPCMD list sites /state:Stopped
List all websites that are not set to autostart and are not running
APPCMD list sites /serverAutoStart:false /state:Stopped
List worker processes
APPCMD list wps
List worker processes for a specific AppPool
APPCMD list wps /apppool.name:DefaultAppPool
List currently executing requests on the server
APPCMD list requests
List currently executing requests on the server for a specific AppPool
APPCMD list request /apppool.name:DefaultAppPool
Managing Backups
AppCmd allows you to create and restore backups of global server configuration.
Create a new backup with auto-generated name that represents the date and time of backup
APPCMD add backup
Create a new backup with a specific name
APPCMD add backup MyBackup
List available backups
APPCMD list backups
Restore a backup named “MyBackup”
APPCMD restore backup "MyBackup"
Sites / Applications
AppCmd allows you to create and restore backups of global server configuration.
List all sites
APPCMD list sites
Detailed view of the Default Web Site
APPCMD list site "Default Web Site" /text:*
Change the ID property of the “Default Web Site”
APPCMD set site "Default Web Site" /id:200
Examine the applications that belong to the Default Web Site
APPCMD list apps /site.name:"Default Web Site"
Create a new site
APPCMD add site /name:MyNewSite /id:2 /bindings:"http/*:81:" /physicalPath:"C:MyNewSite"
Delete the site named “MyNewSite”
APPCMD delete site "MyNewSite"
Add an application to an AppPool
APPCMD set app "MySite/" /applicationPool:MyAppPool
Get a list of all sites in an XML format
APPCMD list sites /xml
Virtual Directories
AppCmd allows you to create and restore backups of global server configuration.
List all virtual directories
APPCMD list vdirs
Examine the virtual directories that belong to the Default Web Site
APPCMD list vdirs /app.name:"Default Web Site/"
Create a new virtual directory
APPCMD add vdir /app.name:"MySite/app1" /path:/vdir1 /physicalPath:C:inetpubmysiteapp1vdir1
AppPools
AppCmd allows you to create and restore backups of global server configuration.
Examine the app pools
APPCMD list apppools
Create a new app pool
APPCMD add apppool /name:MyAppPool
Add a site to an app pool
APPCMD set app "MySite/" /applicationPool:MyAppPool
Stop an AppPool
APPCMD stop apppool "DefaultAppPool"
List an application in detailed view:
APPCMD list apppool "MyAppPool" /text:*
Change managedRuntimeVersion property to “v1.1” to run all applications in this AppPool with ASP.NET v1.1
APPCMD set apppool "MyAppPool" /managedRuntimeVersion:v1.1
Set a nested property of processModel for an entire AppPool
APPCMD set apppool "MyAppPool" /processModel.pingingEnabled:false
Check version,mode and state of an AppPool
APPCMD list apppools DefaultAppPool
Search the AppPools for all running
APPCMD list apppools /state:started
Configuration
List all effective configuration for the root application of the Default Web Site
APPCMD list config "Default Web Site/"
List a specific section (ASP) of the configuration for the root application of the Default Web Site
APPCMD list config "Default Web Site/" /section:asp
Set the appAllowClientDebug property of the ASP section for the http://localhost/app
APPCMD set config "http://localhost/app1" /section:asp /appAllowClientDebug:false
Limit no of requestQueues to 4000
APPCMD set config "http://localhost/app1" /section:asp /limits.requestQueueMax:4000
Set the type property on the collection element with the key name property equal to “FormsAuthentication”
APPCMD set config /section:system.webServer/modules /[name='FormsAuthentication'].type:System.Web.Security.FormsAuthenticationModule
Add a new module collection element with the + sign
APPCMD set config /section:system.webServer/modules /+[name='MyModule',type='MyType']
Remove a module collection element with the – sign
APPCMD set config /section:system.webServer/modules /-[name='MyModule']
Turn directory browsing off for an application and write that configuration within the Web.config file of the site root
APPCMD set config http://localhost/app1/ /section:directoryBrowse /enabled:false /commit:site
Unlock a section from server level so that you can edit it on a lower level
APPCMD unlock config /section:asp
Lock a section to bring the configurations from the server level
APPCMD lock config /section:asp
Find all configuration locations for a particular site
APPCMD search config "Default Web Site/"
Find all configuration locations for a particular that set a property to a specific value
APPCMD search config "Default Web Site/" /section:directoryBrowse /enabled:true
Display configuration for Default Web Site in XML format
APPCMD list site "Default Web Site" /config
We need your help!
Do you know a command that we haven’t included in this APPCMD IIS CheatSheet?
Help us keep the APPCMD CheatSheet up-to-date and enrich it by sharing the APPCMD commands for IIS that you know with other system administrators.