Tuesday, March 14, 2006

Command-line shortcuts to start/stop/reset the IIS service

The application that I develop at work runs in a client/server environment where the server is a Windows machine running IIS. I tend to reset the IIS service on the development server reasonably frequently, as it's a quick and easy way to clear any data that has been cached in memory on the server.

I used to start and stop the IIS service when necessary by going through Start | Control Panel | Administrative Tools | Services, selecting the IIS Admin service, and clicking the "start", "stop", or "restart" button on the toolbar as necessary. Eventually I decided that going through this multi-step procedure every time was too slow, and went looking for some ways to accomplish the same tasks from the command line. The shortcuts below work with IIS 5, and I believe they also work with IIS 6.

iisreset

This resets the IIS Admin service, including the World Wide Web Publishing service.

iisreset /timeout:0

This resets the IIS Admin service faster. According to the help information (iisreset /?), iisreset normally might wait up to 20 seconds to wait for a successful stop of internet services before the restart is performed. The timeout:0 parameter causes the reset to be performed immediately.

net stop iisadmin /y

This stops the IIS Admin service and dependent services (including the WWW service) without restarting them. The /y parameter skips the confirmation prompt that would otherwise be displayed.

net start w3svc

This starts the WWW and IIS Admin services after they were previously stopped.

1 comment:

  1. You haven't updated this in a while. How are we supposed to get our techonology fix?!

    ReplyDelete

Non-spammers: Thanks for visiting! Please go ahead and leave a comment; I read them all!

Attention SPAMMERS: I review all comments before they get posted, and I REPORT 100% of spam comments to Google as spam! Why not avoid getting your account banned as quickly -- and save us both a little time -- by skipping this comment form and moving on to the next one on your list? Thanks, and I hope you have a great day!