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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access