12.2. Stopping and Starting IIS

Problem

You want to stop and restart IIS as a whole, individual IIS services, or individual sites.

Solution

Using a graphical user interface

  1. Open Internet Information Services (IIS) Manager.

  2. To restart all IIS services on the server:

    1. In the left pane, right-click on the server node and select All Tasks Restart IIS.

    2. Choose whether to restart IIS, stop IIS, start IIS, or reboot the server and click OK.

  3. To restart an individual web or FTP site, right-click on the node for the site and select Stop, then repeat and select Start.

Using a command-line interface

The following command restarts all IIS services on the computer:

> iisreset

To stop IIS services on a remote computer with IP address 172.16.12.5 do the following:

> iisreset 172.16.12.5 /stop

To verify that IIS services have been stopped on the remote computer, do the following:

> iisreset 172.16.12.5 /status

To prevent iisreset from being used to stop IIS services, type the following command at the local console of your IIS computer:

> iisreset /disable

To stop the WWW service only on your IIS computer:

> net stop w3svc

To start it again:

> net start w3svc

To stop the IISAdmin service and all dependent IIS services:

> net stop /y iisadmin

To stop the Default Web Site only while leaving other web sites running, use this command:

> iisweb /stop "Default Web Site"

To start it again:

> iisweb /start "Default Web Site"

Using VBScript

' This code stops and starts the specific web site. ' ------ SCRIPT CONFIGURATION ------ strComputer ...

Get Windows Server Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.