Internet Information Services 5.0 Command-Line Syntax for Iisreset.exe

Article translations Article translations
Article ID: 202013 - View products that this article applies to.
This article was previously published under Q202013
Expand all | Collapse all

SUMMARY

Microsoft Internet Information Services (IIS) version 5.0 adds a new command-line utility, Iisreset.exe, which can be used to restart IIS or schedule restarting your computer.

MORE INFORMATION

Iisreset.exe is designed to easily allow Web administrators to take a server offline or recycle services through the command line, the Task Scheduler, or batch commands that perform additional tasks.

In the example shown below, an administrator could write a batch file that stops the Web services to flush the IIS logs, and then copy the logs to another server or perform other housekeeping tasks, and then restart the services.

The syntax for using Iisreset.exe is as follows:
IISRESET [computer name] [/option] [/option] [(and so on)]
The default behavior if no options are specified is to stop and restart the Web services on the local computer.

Iisreset.exe supports the following command-line parameters:
/RESTART
This option stops, and then restarts all running Internet services.
/START
This will start all Internet services that are set to autostart.
/STOP
This will stop all running Internet services.
/REBOOT
This parameter will restart the computer.
/REBOOTONERROR
This restarts the computer only when an error occurs when trying to start, stop, or restart the Internet services.
/NOFORCE
Do not shut down Internet services on failure to stop them gracefully.
/TIMEOUT:val
This allows you to specify the timeout value in seconds waiting for a successful stop of Internet services. On expiration of this timeout, the computer can be restarted if the /REBOOTONERROR parameter is specified. The default value is 20 seconds for restart, 60 seconds for stop.
/STATUS
This displays the status of all Internet services.
/ENABLE
This enables the Restart API for Internet services.
/DISABLE
This will disable the Restart API for Internet services.
Examples:

The following command will attempt to restart all running Web services and reboot the computer if the command is not successful for any reason:
IISRESET /RESTART /REBOOTONERROR
This following will attempt to restart all running Web services, yet if either the stop or restart commands are not successful within two minutes, the computer will restart:
IISRESET /RESTART /TIMEOUT:120 /REBOOTONERROR
The purpose of the following commands, when saved to a batch file, is to stop all running Web services, copy the log files for the default Web server to a backup directory on the D: drive, and then start all Web services. However, if the stop command fails for some reason, it will not shut down the services, but simply exit the batch file:
@echo off
IISRESET /STOP /NOFORCE
if errorlevel == 1 goto EXIT
copy %systemroot%\system32\LogFiles\W3SVC1 d:\backup\W3SVC1
IISRESET /START
:EXIT
Any of the preceding examples can be scheduled to run during non-peak hours for your server using Task Scheduler. For more information on how to accomplish this, search for Task Scheduler in Windows Help.

Properties

Article ID: 202013 - Last Review: November 21, 2006 - Revision: 2.1
APPLIES TO
  • Microsoft Internet Information Services 5.0
Keywords: 
kbinfo KB202013
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com