:: (C) Compaq Computer Corp. - Sample script for StorageWorks Enterprise Volume Manager

REM	Note: Sample script is expecting CPQLE.EXE, ESEUTIL.EXE, and CHECKDB.EXE to be 
REM        	in a directory in the System PATH.  CPQLEMESS.DLL is required in
REM		the %systemroot%\system directory.   
REM
REM     Requires: Exchange 5.5 (Service Pack 2 or greater),
REM		  StorageWorks Enterprise Volume Manager,			
REM		  CPQLE.EXE,CPQLEMESS.DLL,ESEUTIL.EXE,CHECKDB.EXE
REM
REM
REM *********************************************************************************
REM     Modify this section with drive:\path for edb.log 
REM *********************************************************************************

REM SetLocal variables

SET LogLocate=E:\exchsrvr\mdbdata

REM *** Modify this section with the variable EVM Job and EDB drive letter names from
REM	your system. 

REM *** EVMJOBClone is the variable name for the EVM Job created
REM     The EVM Job is created from the Compaq StorageWorks EVM Manager
REM	Additonal PRE/POST processing can be scheduled from the EVM Manager
SET EVMJOBClone=stor1_CloneExchangePrivEdb

REM *** EDBDrive is the variable name for the volume that contains the EDB file
SET EDBDrive=G

REM *** EXCHANGEServer is the variable name for the Exchange Server
SET EXCHANGEServer=P6000x

REM *********************************************************************************
REM	End Modification section: Save the Clonecopy.cmd file
REM *********************************************************************************


@echo OFF
REM SET echo=ON
@if not "%ECHO%"=="" echo %ECHO%

REM *********************************************************************************
REM  	STOP THE MICROSOFT EXCHANGE INFORMATION STORE AND DEPENDENCIES 
REM *********************************************************************************

net stop MSExchangeIS /y
REM IF %ERRORLEVEL%==1 GOTO EXITonESEStopErr


REM *********************************************************************************
REM 	DUMP edb.log header and store for input to log verification (CHECKLOG.EXE) utility 
REM     Note: CHECKLOG.EXE is used in the Clonerec.cmd file
REM *********************************************************************************

md c:\compaq\swevm\log\
eseutil /ml %LogLocate%\edb.log > c:\compaq\swevm\log\dumplog.out
dir %LogLocate%\edb*.log /OD /B >> c:\compaq\swevm\log\dumplog.out

REM *********************************************************************************
REM 	RUN EVM JOB TO UNDO THE OLD CloneSHOT                                                                             
REM *********************************************************************************

net time \\%computername% >> c:\compaq\swevm\log\Clone.out
CD c:\compaq\swevm\bin
swevmcl %EXCHANGEServer% undo_%EVMJOBClone% 
IF %ERRORLEVEL%==0 CPQLE 4 2000 "PROCESS:%0,  Remove previous CloneSHOT Complete.  COMMAND:swevmcl %EXCHANGEServer% undo_%EVMJOBClone%"
REM CPQLE 4 2010 "PROCESS:%0,  Clone:%EVMJOBClone% DID NOT DELETE. "



REM *********************************************************************************
REM 	NORMALIZE THE NEW CloneSHOT FROM THE PRIMARY DATABASE UNIT               
REM *********************************************************************************

swevmcl %EXCHANGEServer% %EVMJOBClone% 
CPQLE 4 2001 "PROCESS:%0,  Create new CloneSHOT COMPLETE.  COMMAND:swevmcl  %EXCHANGEServer%  %EVMJOBClone%"



REM ********************************************************************************
REM 	DETERMINE AND STORE LAST CONSISTENT TRANSACTION LOG                                
REM ********************************************************************************

eseutil /mh %EDBDrive%:\exchsrvr\mdbdata\priv.edb > c:\compaq\swevm\log\PrivMH.out
IF %ERRORLEVEL%==1 CPQLE 2 2011 "PROCESS:%0,  WARNING !!! eseutil /mh %EDBDrive%:\exchsrvr\mdbdata\priv.edb NOT SUCCESSFUL "

eseutil /mh %EDBDrive%:\exchsrvr\mdbdata\pub.edb > c:\compaq\swevm\log\PubMH.out
IF %ERRORLEVEL%==1 CPQLE 2 2012 "PROCESS:%0,  WARNING !!! eseutil /mh %EDBDrive%:\exchsrvr\mdbdata\pub.edb NOT SUCCESSFUL "

checkdb.exe c:\compaq\swevm\log\PrivMH.out > c:\compaq\swevm\log\privedb.out 
REM IF %ERRORLEVEL%==1 CPQLE 2 2013 "PROCESS:%0,  WARNING !!! CHECKDB.EXE Integrity check of  %EDBDrive%:\exchsrvr\mdbdata\pub.edb NOT SUCCESSFUL "
checkdb.exe c:\compaq\swevm\log\PrivMH.out >> c:\compaq\swevm\log\Clone.out 

checkdb.exe c:\compaq\swevm\log\PubMH.out > c:\compaq\swevm\log\Pubedb.out 
REM IF %ERRORLEVEL%==1 CPQLE 2 2014 "PROCESS:%0, WARNING !!! CHECKDB.EXE Integrity check of  %EDBDrive%:\exchsrvr\mdbdata\priv.edb NOT SUCCESSFUL "
checkdb.exe c:\compaq\swevm\log\PubMH.out >> c:\compaq\swevm\log\Clone.out 


REM *********************************************************************************
REM  	START THE MICROSOFT EXCHANGE INFORMATION STORE AND DEPENDENCIES 
REM  	Note: The Microsoft Exchange Event Service, Key Manager Service, Internet
REM   		Mail Service are dependencies of the Information Store
REM *********************************************************************************

net start MSExchangeIS
net start MSExchangeES
net start MSExchangeIMC
net start MSExchangeKMS

net time \\%computername% >> c:\compaq\swevm\log\Clone.out



EXIT


REM *********************************************************************************
REM Error Section
REM *********************************************************************************

:EXITonESEStopErr
CPQLE 2 2015 "PROCESS:%0,  WARNING !!! The program %0 exited on an NET STOP MSExchange IS /y error. %EZStatement%"
GOTO END


:END
EXIT