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.exe supports the following command-line parameters:
This option stops, and then restarts all running Internet services.
This will start all Internet services that are set to autostart.
This will stop all running Internet services.
This parameter will restart the computer.
This restarts the computer only when an error occurs when trying to start, stop, or restart the Internet services.
Do not shut down Internet services on failure to stop them gracefully.
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.
This displays the status of all Internet services.
This enables the Restart API for Internet services.
This will disable the Restart API for Internet services.
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 /STOP /NOFORCE
if errorlevel == 1 goto EXIT
copy %systemroot%\system32\LogFiles\W3SVC1 d:\backup\W3SVC1
ID do Artigo: 202013 - Última Revisão: 22/06/2014 - Revisão: 1