Mirroring script for SQL Server / Sharepoint
http://spadmin.spaces.live.com/blog/cns!F030C52B8E5517C3!352.entry
I was working in one of my SharePoint test labs this weekend, and decided to write a script that would recycle, stop or start all of the SharePoint Key services. Copy the text and save it as ManageServices.bat
Enjoy
@ECHO OFF
:CHOICE
CLS
ECHO.
ECHO **********************************************************************
ECHO.
ECHO ** Recycle, Stop, Start SharePoint Key Services
ECHO.
ECHO ** Created April 23 2008
ECHO ** Gene Magerr
ECHO ** genemagerr@hotmail.com
ECHO ** Version 1.0 – April 23 2008
ECHO ** 1.1 -
ECHO ** 1.2 -
ECHO **
ECHO **
ECHO ** You have a royalty-free right to use, modify, reproduce, and
ECHO ** distribute this script file in any way you find useful, provided that
ECHO ** you agree that the creator, owner above has no warranty, obligations,
ECHO ** or liability for such use.
ECHO.
ECHO ** This batch file will Recycle, Stop or Start all of the key
ECHO ** SharePoint 2007 services. It will also do an IISRESET /NOFORCE
ECHO ** after each of the tasks.
ECHO.
ECHO **********************************************************************
ECHO.
ECHO Please choose a menu option.
ECHO.
ECHO Recycle all services …………………. 1
ECHO Stop all services ……………………. 2
ECHO Start all services …………………… 3
ECHO Quit (without affecting services) ……… 4
ECHO.
CHOICE /C:1234 /N /T:180 /D:4
ECHO.
IF ERRORLEVEL == 4 GOTO END
IF ERRORLEVEL == 3 GOTO START
IF ERRORLEVEL == 2 GOTO STOP
IF ERRORLEVEL == 1 GOTO RECYCLE
:RECYCLE
ECHO Stopping and restarting key services
ECHO.
net stop oSearch
net stop SPAdmin
net stop SPTimerv3
net stop SPTrace
net start oSearch
net start SPAdmin
net start SPTimerv3
net start SPTrace
PING 1.1.1.1 -n 1 -w 2000 >NUL
ECHO Recycling IIS
ECHO.
IISRESET /NOFORCE
PAUSE
GOTO CHOICE
:STOP
ECHO Stopping key services
ECHO.
net stop oSearch
net stop SPAdmin
net stop SPTimerv3
net stop SPTrace
PING 1.1.1.1 -n 1 -w 2000 >NUL
ECHO Stopping IIS
ECHO.
IISRESET /STOP
PAUSE
GOTO CHOICE
:START
ECHO Starting key services
net start oSearch
net start SPAdmin
net start SPTimerv3
net start SPTrace
PING 1.1.1.1 -n 1 -w 2000 >NUL
ECHO Starting IIS
ECHO.
IISRESET /START
PAUSE
GOTO CHOICE
:END