HOW TO: Use Iisreset.exe and Task Scheduler to Schedule IIS to Restart in Windows 2000

Article translations Article translations
Article ID: 317584 - View products that this article applies to.
This article was previously published under Q317584
Notice
This article applies to Windows 2000. Support for Windows 2000 ends on July 13, 2010. The Windows 2000 End-of-Support Solution Center is a starting point for planning your migration strategy from Windows 2000. For more information see the Microsoft Support Lifecycle Policy.
Notice
This article applies to Windows 2000. Support for Windows 2000 ends on July 13, 2010. The Windows 2000 End-of-Support Solution Center is a starting point for planning your migration strategy from Windows 2000. For more information see the Microsoft Support Lifecycle Policy.
Expand all | Collapse all

On This Page

SUMMARY

This step-by-step article describes how to use Iisreset.exe and Task Scheduler to schedule Internet Information Services (IIS) 5.0 to restart.

You can use either the IIS snap-in or the Iisreset.exe command-line utility to start, stop, and restart Internet services. If you want to schedule IIS to restart on a particular day and time, use Iisreset.exe with Task Scheduler.

Overview of Iisreset.exe

Iisreset.exe uses the following syntax:
iisreset[ computername]
NOTE: Items in [] are optional.

While iisreset will run this without arguments, you may wish to perform other functions. You can use the following parameters with Iisreset.exe:
  • computername: Use this parameter to specify the computer that you want to manage. If you omit this parameter, the local computer is specified.
  • /restart: Use this parameter to stop and restart all of the running Internet services.
  • /start: Use this parameter to start all of the Internet services that are stopped.
  • /stop: Use this parameter to stop all of the running Internet services.
  • /reboot: Use this parameter to restart the computer.
  • /rebootonerror: Use this parameter to restart the computer if an error occurs after the Internet services attempt to start, stop, or restart.
  • /noforce: Use this parameter so that the Internet services do not shut down forcefully if you cannot stop the services gracefully.
  • /timeout:value Use this parameter (where value is a timeout value in seconds) to specify the time the computer waits for the Internet services to stop. After the computer stops, it restarts if you use the /rebootonerror parameter. The following list describes the default values:
    • The default value is 20 seconds if you use this parameter with /restart.
    • The default value is 60 seconds if you use this parameter with /stop.
    • The default value is 0 seconds if you use this parameter with /reboot.
  • /status: Use this parameter to display the status of all of the Internet services.
  • /enable: Use this parameter to enable the Internet services to restart.
  • /disable: Use this parameter to disable the Internet services restart process.

How to Schedule IIS to Restart

To schedule IIS to restart on the local computer, follow these steps:
  1. Click Start, point to Settings, and then click Control Panel.
  2. Double-click Scheduled Tasks.
  3. Double-click Add Scheduled Task, and then click Next.
  4. Click Browse, navigate to the %SystemRoot%\System32 folder, click Iisreset.exe, and then click Open.
  5. Either accept the default name that is displayed in the Type a name for this task box or type the name that you want to use.
  6. Under Perform this task, click the interval that you want to use for this task, and then click Next.
  7. If you chose to schedule a daily task, a weekly task, a monthly task, or a task that runs only one time in step 6, specify the time and the day when you want the task to run, and then click Next.
  8. Type the user name and the password of a user account in which you want to run the task, and then click Next.

    This account must be a member of the Administrators group. You must type the user name by using the following format, where domain is the domain name and username is the user account in which you want to schedule the task:
    domain\username
  9. Click to select the Open advanced properties for this task when I click Finish check box, and then click Finish.
  10. Click the Task tab.
  11. At the end of the command line that is displayed in the Run box, insert a space, type /restart, and then click OK.

    For example, to stop and restart IIS services on the local computer, the command line that is displayed in the Run box should look similar to the following command line, where drive is the drive on which Windows is installed:
    drive:\winnt\system32\iisreset.exe /restart
    NOTE: You can use other Iisreset.exe parameters in combination with /restart. For example, to restart the computer if an error occurs less than one minute after the Internet services attempt to start, use the /rebootonerror parameter and the /timeout:value parameter. In this scenario, the command line that is displayed in the Run box looks similar to the following command line:
    drive:\winnt\system32\iisreset.exe /restart /rebootonerror /timeout:60
    Alternatively, if you want to schedule the computer to restart, use the /reboot parameter. In this scenario, the command line that is displayed in the Run box looks similar to the following command line:
    drive:\winnt\system32\iisreset.exe /reboot
  12. Verify that the new task is displayed in the Scheduled Tasks window, and then close the Scheduled Tasks window.

Troubleshooting

A scheduled restart of IIS does not occur after you create the task in Task Scheduler.

This behavior can occur if the task is not configured correctly. To resolve this behavior, follow these steps:
  1. Click Start, point to Settings, and then click Control Panel.
  2. Double-click Scheduled Tasks.
  3. Right-click the task, click Properties, and then click the Task tab
  4. Verify that the correct command line is displayed in the Run box.
  5. Verify that the correct user account is displayed in the Run as box, and that you typed the user account in the domain\username format.
  6. Click Set password, and then type the password again if necessary.

    The Scheduled Task Wizard does not verify the password after you originally create the task. Make sure that you type the correct password for the user account.
  7. Verify that the Enabled (scheduled task runs at specified time) check box is selected.
  8. Click the Schedule tab, and then verify that the task start times and start dates are correct.
  9. Click OK, and then close the Scheduled Tasks window.

REFERENCES

For additional information about Iisreset.exe, click the article number below to view the article in the Microsoft Knowledge Base:
202013 Internet Information Services 5.0 Command-Line Syntax for Iisreset.exe
For additional information about how to use Task Scheduler in Windows 2000, click the article number below to view the article in the Microsoft Knowledge Base:
300160 HOW TO: Schedule a Server Process in Windows 2000
226795 How to Modify a Scheduled Task to Repeat By Minutes or Hours
310208 HOW TO: Prevent Users from Scheduling Tasks
For additional information about how to use the AT command to schedule tasks, click the article number below to view the article in the Microsoft Knowledge Base:
313565 HOW TO: Use the AT Command to Schedule Tasks
For more information about IIS, refer to the IIS 5.0 documentation. If IIS is installed on the computer, start Microsoft Internet Explorer, type the following address in the Address box, and then press ENTER:
http://localhost/iisHelp/
Alternatively, view the IIS 5.0 documentation at the following Microsoft Web site:
http://technet.microsoft.com/en-us/windowsserver/2000/bb735378.aspx

Properties

Article ID: 317584 - Last Review: October 30, 2006 - Revision: 3.4
APPLIES TO
  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Professional Edition
Keywords: 
kbhowto kbhowtomaster KB317584

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