Attention: We are retiring the IIS.NET Community Blogs. Learn more >

How To: AppCMD in IIS 7 - An Introduction

AppCMD is the main command line utility for managing IIS 7 within Windows Vista and Windows Sever 2008...I have felt navigating through AppCMD is easier than ADSUTIL.vbs (its predecessor) but here's an entry nevertheless for the beginners.

Below are a few basic commands and tips to get you started.

AppCMD is found in %windir%/system32/inetsrv. You will need to run the command prompt with elevated priviliges to access this command line utility.

Appcmd /? - This will give you the help for the utility

Appcmd list sites - This will list all the sites on the sever along with their ID, Bindings and State.

Appcmd list config -section:? - This will list all the available section names

Appcmd list config "Default web site" - This will list the entire configuration of the "Default Web Site"

Appcmd list wp - This will list all the worker processess running at the system.

Appcmd start site "Default Web site" - This will start the Default Website

Appcmd stop site "Default Web site" - This will stop the Default Website

Appcmd list appPool - This will give you information of the running Application pools on your machine along with their managed version, managed mode and state.

Scenario 1: I would like to find out the default document for my default website and add a new document named sample.htm in it.

The scenario is simply 2 questions, therefore run the following 2 commands to achieve the result.
Appcmd list config "Default Web Site"-section:defaultDocument

Appcmd set config "Default Web Site"-section:defaultDocument /+files.[@end,value='sample.html']
The above command will add the file sample.htm at the end of the default document list. You might run the 1st command once again to verify that the document has been added to the list.

Scenario 2: I want to collect the configuration of my default web site in a separate file named configuration.txt and place it in d:\

Here's the command for that:
Appcmd list config "Default Web Site" >d:\configuration.txt
Just to verify try this:

notepad d:\configuration.txt - This shall bring up a notepad showing you the configuration of your Default Web Site.

Scenario 3: I want to find the current requests being served by the Default App Pool.

You will need to put in this command to get the required information:
Appcmd list requests /apppool.name:DefaultAppPool
The rest I leave for you to try out! Have fun ...

No Comments