A SharePoint developer’s life is filled with many things, but one of the most common is the old faithful iisreset, coupled with a reset of the Timer Service and the Admin Service. When you’re working on timer jobs, it can get tedious quickly to have to keep resetting things.
So I’m sharing a useful batch script I knocked together to do it for you. It will perform three functions – restart the SharePoint 2010 Timer Service, the SharePoint 2010 Administration Service and do an IISReset. It will prompt you if you want to do each of them, and if you don’t reply within 5 seconds automatically do it.
Simply save it as a .cmd file, and then create a shortcut to it, and put that shortcut on your start menu/quick launch. Restarts ahoy!
@echo off @echo Quick SharePoint services restart - from www.thorntontechnical.com @echo Stopping Sharepoint services... :P1 REM - SharePoint timer service CHOICE /C:YN /M "Restart Timer Service?" %1 /T 5 /D Y if ERRORLEVEL ==2 GOTO P2 if ERRORLEVEL ==1 GOTO A1 :A1 net stop "sharepoint 2010 timer" net start "sharepoint 2010 timer" :P2 REM - SharePoint timer service CHOICE /C:YN /M "Restart Admin Service?" %1 /T 5 /D Y if ERRORLEVEL ==2 GOTO P3 if ERRORLEVEL ==1 GOTO A2 :A2 net stop "sharepoint 2010 administration" net start "sharepoint 2010 administration" :P3 REM - reset IIS CHOICE /C:YN /M "Reset IIS?" %1 /T 5 /D Y if ERRORLEVEL ==2 GOTO END if ERRORLEVEL ==1 GOTO A3 :A3 iisreset -restart -noforce :END echo Finished. Thanks. Have fun.