Appcmd with WinRM IIS administrators is the swiss-army knife
AppCmd.exe is a command line tool for managing IIS 7+ (IIS 7, 7.5 end 8.0). It makes all major server management functionality available, via a set of intuitive management objects that are manipulated (changed, adapted) may be using the cmd.exe command line or via scripts (For example, PowerShell).
Appcmd makes managing a server without graphical interface, such as Windows Server 2008 Core Edition, possible, without writing custom code.
An introduction and overview of (the possibilities of) Appcmd state here. Some of the management tasks that you can perform are:
- Create and configure sites, applications, application pools, and virtual directories
- Starting and stopping sites, and recycle application pools
- Show running worker processes and displays current running requests
- To Search, manipulate (modify / customize), Export and import of IIS and ASP.NET configurations
Appcmd usage / syntax
AppCmd (command) (object-type) <identify> </parameter1:value1 …>
Useful APPCMD.exe assignments (commando’s):
Request site data
AppCmd.exe list site "Default Web Site"
Request site data parameters
Or, on the basis of a parameter (which sites are stop, and not server autostart are set to):
AppCmd.exe list sites /state:Stopped AppCmd.exe list sites /serverAutoStart:false /state:Stopped
Stop and start a website
AppCmd.exe stop site "site name" AppCmd.exe start site "site name"
Stop, start and recycle an application pool
starting with, or without autostart
AppCmd.exe stop AppPool "AppPool_naam" AppCmd.exe start AppPool "AppPool_naam" AppCmd.exe start AppPool "AppPool_naam" /autostart:true AppCmd.exe recycle AppPool "AppPool_naam"
Start all stopped application pools (AppPool’s)
AppCmd list AppPools /state:stopped /xml | AppCmd start AppPool /in
AppCmd list AppPool /state:stopped /xml | AppCmd start AppPool /in
Of, with Autostart
AppCmd list AppPool /state:stopped /autostart:true /xml | AppCmd start AppPool /in
The output of list AppPools /state:stopped is stored in XML, and piped to the AppCmd start-command that reads with this /in.
Set all AppPools on Integrated ManagedPipelineMode
AppCmd list AppPools /xml | AppCmd set AppPool -managedpipelinemode:Integrated /in
PHP / FastCGI configuratiwijziging
Make a change in the PHP / FastCGI configuration:
AppCmd.exe set config -section:system.webServer / FastCGI /+"[fullPath='c:\\php5\php-cgi.exe'].environmentVariables. [name='PHP_FCGI_MAX_REQUESTS',value='10000']" /commit:apphost
Request username and password AppPool
AppPool username and password
Username and password of an AppPool request:
AppCmd list AppPool AppPool_naam /text:processmodel.username AppCmd list AppPool AppPool_naam /text:processmodel.password
Website creation with appcmd
Appcmd add site /name:"site1.com" /id:821398 /physicalPath:"c:\\Inetpub\wwwroot\site1" /limits.maxconnections:1000 /server autostart:true
In combination with Windows Remote Management (WinRM) also be carried out on external web servers are these commands. Ideal for management at a central point