Networking HowTos
Networking HowTos

Restart a IIS7 Web Site via the Command Line

April 17, 2012 Microsoft, Windows

This guide shows you how to restart a specific IIS 7 web site from the command line. This can come in very handy if you need to automate restarting the site.
IIS 7 includes a command line management tool called “appcmd.exe” which allows you do do a wide range of tasks, including stopping and starting specific websites.
The “appcmd.exe” program isn’t in the ‘PATH’ environment variable, so you must run it from within the correct folder, or add the folder to your PATH environment variable.
Open a command window by clicking the start button, and typing cmd.exe into the search and hitting enter.
(or by pressing the WINDOWS KEY + r combination on the keyboard, and typing cmd.exe”, and clicking “OK”)

Change to the C drive, or whatever drive your OS/Windows folder is installed on:


Change directory to the location where appcmd.exe resides (c:\windows\system32\inetsrv\):

cd %WINDIR%\system32\inetsrv

Issue the following command to view the web sites available on the server:

appcmd.exe list site

You should get something like the following returned on the screen:

SITE "Default Web Site" (id:1,bindings:http/*:80:,net.tcp/808:*,net.pipe/*,net.m

The main part of this we need to take note of is the site name, which in this case is “Default Web Site”.
Run the following command to stop the specified website, using the above site name to reference what site you want to stop:

appcmd.exe stop site /"Default Web Site"

To start the site back up, run the following command:

appcmd.exe start site /"Default Web Site"

The web site should now be started again.
The whole process should look like this:

Note: You can always reference the appcmd.exe file directly, instead of changing directories first, using the following path:


You Might Also Like