iisreset

An essential tool for sysadmins and developers working with Microsoft’s Internet Information Server (IIS) is the iisreset command. iisreset was introduced with IIS version 5.0 and can be used to stop and start IIS from the command line.

IIS is composed of several Win32 services. A Win32 service is a background process like a Unix daemon. NT kernel based versions of Windows (e.g. Windows NT 4.0, Windows 2000, Windows XP, Windows 2003) support a sophisticated service infrastructure.1

In versions of IIS prior to 6.0 all of the services that compose IIS are housed in inetinfo.exe. In IIS 5.0 (Win2k) and 5.1 (WinXP) these services include the following:

Service Name Protocol Description IISADMIN IIS Administration MSFTPSVC FTP File Transfer Protocol Server NNTPSVC NNTP Network News Server (available on server versions of Windows) SMTPSVC SMTP Mail Transport Server W3SVC HTTP Web Server

The command
iisreset /stop

stops all IIS services. When all the services are stopped the inetinfo process terminates.

To restart use
iisreset /start

The /start switch starts all IIS services that are configured as ‘autostart’.

Prior to 5.0, cycling the web server could be achieved via the net (stop|start) commands.

For example,
net stop iisadmin /y

is equivalent to
iisreset /stop

The other services in IIS are dependent services of IISADMIN. Stopping a superordinate service will also stop any subordinate or dependent services. So stopping IISADMIN is sufficient to stop all the IIS services. (When a service has dependent services, as is the case with IISADMIN, the net stop command will prompt for confirmation. The /y switch provides an automatic confirmation.)

net (stop|start) is still useful because it can be used more selectively than iisreset. net stop w3svc stops the web server only. There is no equivalent with iisreset. But net stop doesn’t have iisreset’s /timeout switch.

The GUI tool for managing IIS, the Internet Services Manager, has start, stop, and pause buttons. Interestingly clicking the stop button in the IIS Manager doesn’t stop the selected service. The web server, for example, will stop responding to requests but any files in use remain locked and in use.

1In the past NT Services have had a reputation for being hard to develop. Services run in a unique context and require some special considerations.

I know of a case where an engineer saved himself the trouble and built a desktop application for something that really truly was a service. It was a short-sighted decision. Some of the consequences include no autostart and no remote administration. The operations staff must curse that guy.