03 February 2012

IIS 7 Command Line Tools: Start and Stop Sites via Command Line

Install IIS 7 Management Scripts and Tools

To use IIS command line tools you will need to install IIS Management Scripts and Tools:

  1. Control Panel; Programs and Features; Turn Windows Features on or off (left hand side)
  2. In Windows Features box Expand Internet Information Services; Web Management Tools and select IIS Management Scripts and Tools:
    IISScriptsAndTools
  3. Select OK and wait while it installs.

To Start and Stop a Site from the Command Line

  1. Open a command prompt: Start, cmd, Enter
  2. Enter the code below:
    %systemroot%\system32\inetsrv\APPCMD START Site [Site.Name]
    Replacing [Site.Name] with the site’s name.

The command takes the following format:
APPCMD (command) (object-type) <identifier> < /parameter1:value1 ... >*

You could use this as part of a project build script to reset the site before debugging.

Ref: http://learn.iis.net/page.aspx/114/getting-started-with-appcmdexe/

No comments:

Post a Comment