Wednesday, September 10, 2008

ShoreTel Server Disaster Recovery

I cannot take credit for all this so here are my sources.

http://blogs.msdn.com/adioltean/archive/2005/01/05/346793.aspx
http://www.eggheadcafe.com/tutorials/aspnet/f6972828-1e81-4cd4-ae0c-36196a82ed25/workstation-open-file-bac.aspx

Using these two scripts we have made the backup script here that copies the Shoreline Data folder onto a backup server in a different location over the network each weekend. It uses the Shadow Copy component of Windows Server 2003 so it will backup even the files that are in use by the ShoreTel phone system. This meets our disaster recovery goals of being able to bring the phone server back online within minuets of a disaster at our primary data center. The loss of changes made to the phone system during the past week is acceptable to us. You could run this backup script daily if that does not meet your goals.


1. Create a scheduled backup of ShoreTel data to your backup server according to the following:

a. You need to get three programs from Microsoft and copy them into the c:\backup folder they are.
i. Vshadow.exe
ii. Robocopy.exe
iii. Dosdev.exe

b. Next you need to create a script backup.cmd in the backup folder that contains the following “code”:

setlocal

@REM test if we are called by VSHADOW
if NOT "%CALLBACK_SCRIPT%"=="" goto :IS_CALLBACK

@REM
@REM Get the source and destination path
@REM

@rem set SOURCE_DRIVE_LETTER=d:
@rem set DESTINATION_PATH=\\sgserver2\d$\Shoreline Data

set SOURCE_DRIVE_LETTER=%~d1
set SOURCE_RELATIVE_PATH=%~pnx1
set DESTINATION_PATH=%2

@REM
@REM Create the shadow copy - and generate env variables into a temporary script.
@REM
@REM Then, while the shadow is still live
@REM recursively execute the same script.
@REM

@echo ...Determine the scripts to be executed/generated...

set CALLBACK_SCRIPT=%~dpnx0
set TEMP_GENERATED_SCRIPT=GeneratedVarsTempScript.cmd

@echo ...Creating the shadow copy...

%~dp0\vshadow.exe -script=%TEMP_GENERATED_SCRIPT% -exec=%CALLBACK_SCRIPT% %SOURCE_DRIVE_LETTER%

del /f %TEMP_GENERATED_SCRIPT%

@goto :EOF

:IS_CALLBACK
setlocal

@REM
@REM This generated script should set the SHADOW_DEVICE_1 env variable
@REM

@echo ...Obtaining the shadow copy device name...

call %TEMP_GENERATED_SCRIPT%

@REM
@REM This should copy the file to the right location
@REM

@echo ...Copying from the shadow copy to the destination path...

@rem
@rem copy "%SHADOW_DEVICE_1%\%SOURCE_RELATIVE_PATH%" "%DESTINATION_PATH%"

@rem create shadow drive.
dosdev.exe B: %SHADOW_DEVICE_1%

@rem make backup of files.
robocopy.exe "B:\%SOURCE_RELATIVE_PATH%" %DESTINATION_PATH% /MIR

@rem destory shadow drive.
dosdev.exe -r -d B:

c. You run the script by going into the c:\backup folder, and running backup.cmd “local directory to backup” “\\path to remote server\target directory\” you will need to make sure that the user that is running the script has access to both directories.

d. Now you can schedule the script to run daily/weekly/whatever.






2. Configure all ShoreTel phones, and switches to boot via DHCP to get FTP server from DHCP options.

a. See ShoreTel, and Microsoft Documentation to configure switches for DHCP, and IP address reservations in MS DHCP server for your ShoreTel switches.

3. To recover from a disaster.

a. Change the IP address of your ShoreTel server in the ShoreWare.mdb on your backup server.
i. You will need MS Access, and it’s in the switches table.

b. Install the ShoreTel software on your backup server.

c. Contact ShoreTel to get a new license as the MAC address has changed it will need re-licensed. They should do this for free as your primary server is down. You will need to do this again once you can bring your primary server back online.

d. Update your DHCP ftp option to point to the backup servers IP address.

e. Reboot your switches, and then phones.