Monday, June 11, 2012

Batch file to restart IIS service


Batch file to restart service

net stop "IIS Admin Service"
net start "IIS Admin Service"

You can change the name in the quotes to whatever other service.  If you run it manually, make sure to "Run it as administrator".  If you are using it in a scheduled task, you will need to give it the necessary permissions

[EDIT]
If you get:
The following services are dependent on the IIS Admin Service service. Stopping the IIS Admin Service service will also stop these services.

World Wide Web Publishing Service
HTTP SSL

Do you want to continue this operation? (Y/N)

Then edit the batch file to include another parameter for this choice


net stop "IIS Admin Service" /yes
net start "IIS Admin Service"

[EDIT 2]
Apparently using the above will sometimes stop all websites


No comments:

Post a Comment