Is there a way to stop and start the IIS server from command prompt RRS feed

  • Question

  • User-837879238 posted
    I am trying to restore a database on a regular basis. Is there a way to stop and start the IIS server using a command prompt. I want to schedule this event. Thanks for the help in advance. Irene
    Saturday, August 16, 2003 10:04 PM

All replies

  • User1341174311 posted
    I think iisreset.exe will do this for you.
    Saturday, August 16, 2003 10:06 PM
  • User-1804824805 posted
    You can also use: NET STOP "World Wide Web Publishing Service" and then NET START "World Wide Web Publishing Service" or NET STOP "W3SVC" and then NET START "W3SVC"
    Saturday, August 16, 2003 11:19 PM
  • User1304300957 posted
    Hi Irene, Here's the method that I follow whenever I need to restart IIS. Open a new text file from notepad. type the following commands in the text file net stop w3svc net stop iisadmin net start iisadmin net start w3svc Save the file as RestartIIS.bat on to your desktop. whenever you want to restart your IIS...just double click the RestartIIS.bat on ur desktop. bingo.....
    Friday, August 22, 2003 1:51 PM
  • User-1430188240 posted
    iisreset.exe is the best choice since it's built especially for this purpose... iisreset /start iisreset /stop iisreset /restart If you're create a kind of windows service which automatically performs this task, consider to use the built-in classes of the .NET Framework (i.e. the ServiceController class) to stop/start the IIS services. Little question... Why do you want to restart IIS on a regular basis? If you need to do this, it's better to look for the real reason why this is needed (for example, misconfiguration). If it's a problem of recycling worker processes etc, take a look at IIS 6 which is shipped in Windows Server 2003. By using IIS 6, you don't need to restart IIS anymore for this simple tasks, since you can configure IIS to recycle etc the processes itself.
    Friday, August 22, 2003 3:52 PM
  • User502787105 posted
    Before IISReset.exe appeared you would have used: net stop iisadmin /y from the command prompt and to restart net start w3svc Cheers Gregor Suttie
    Tuesday, August 26, 2003 10:40 AM
  • User735571241 posted

    I know it's old school, but if you turn this into a .bat file and schedule it to run, you can restart IIS and SQL server + SQL Agent everynight:

    @echo off
    REM - File: iisrestart.bat

    echo Restarting IIS...
    echo ======================================================

    net stop W3SVC
    net start W3SVC

    echo ======================================================
    echo IIS Restarted


    echo Restarting SQL...
    echo ======================================================

    net stop "SQL Server Agent (MSSQLSERVER)"
    net stop MSSQLSERVER
    net start MSSQLSERVER
    net start "SQL Server Agent (MSSQLSERVER)"

    echo ======================================================
    echo SQL Restarted

    Wednesday, April 2, 2008 6:34 PM
  • User-929678430 posted

    Open Command prompt with Run as Administrator and use the below command 


    this command stops and after Start the IIS, for this you can create a .bat file and add Create a task in Task scheduler.

    Thursday, October 9, 2014 3:50 AM
  • User1196771204 posted

    two whumbs up to arueru post

    I agree that you can create a .bat file to restart the IIS

    Friday, October 17, 2014 3:54 AM