Automating IIS Administration

Many scripts are available for administering IIS from the command-line, and they’re detailed in this section. Most of these are located in the \inetpub\adminscripts directory; exceptions are noted within the individual command’s discussion.

iisreset

You can control IIS using a command-line function called iisreset. Depending on the argument switches you use with the command, you can perform any number of tasks.

iisreset /restart

Restarts all IIS-related services.

iisreset /start

Starts IIS.

iisreset /stop

Stops IIS.

iisreset /reboot

Restarts the actual server machine, not just IIS.

iisreset /rebootonerror

Use this to simply restart IIS—but, if errors are encountered during the process, reboot the server.

iisreset /noforce

Doesn’t forcefully terminate services that don’t respond to requests.

iisreset /timeout:value

IIS will wait for a service to respond for the number of seconds in the preceding value field. If the service still doesn’t respond, and /rebootonerror is used in the command as well, the machine will restart.

iisreset /status

Lists the status of all IIS services.

iisreset /enable && iisreset /disable

Toggles the ability to start or stop IIS services on the machine.

iisweb

iisweb can create new web sites from the command-line. For instance:

iisweb /create e:\webcontent "Main Website" /d www.win.com

creates a web site named Main Website that can be addressed at www.win.com from content stored in the directory e:\webcontent.

By default, iisweb will start ...

Get Learning Windows Server 2003 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.