ShoreTel & Mitel Backup Scripts

  • Home
  • Blog
  • ShoreTel & Mitel Backup Scripts
computer-screen-with-code

This article will show you how to configure ShoreTel & Mitel Backup scripts to work with a shared network drives. This tutorial will focus on setting scripts up for the primary HQ or DVS. As easy as this seems there are some syntax sensitive areas and the entire process needs to work flawlessly in order to work properly. Hopefully this tutorial will help save you some time!

Primary Backup Script

The Mitel backup script is located wherever you decided to install the Shoreline Communications folder, but here is documentation in the Administration Guide if you want more details about this topic.

I’m going to go through what works for most customers. For my example we have installed the Shoreline Communications folder in D:\ to prevent any OS issues from affecting our phone system installation.

 D:\Program Files (x86)\Shoreline Communications\ShoreWare Remote Server\Scripts\Sample_Backup_Restore

The default file to configure is called sw_backup_restore.ini. This file tells the scripts where to look for different drives and tools to accomplish the task. I personally like running my scripting per individual server and if I am backing up the HQ, then I will configure that script to only backup the HQ. If I am backing up a DVS, then I will only configure that specific DVS for backup. This prevents any possibilities of network connectivity issues and keeps everything local to that environment.

Note that backing up conference bridges and v-switches cannot configured locally to those devices, but will be done by using these same backup scripts.

If we look at this INI file, we can break down what each section is for. DO NOT copy and paste the below. I will attach finished files at the end of this article. Be aware you will have to use this article to update your script according to your scenario. I have marked certain areas in bold text to indicate which values you will likely be changing.

If you have changed your username and password settings for your switches, then please update them below. Yes, it is in clear text.

Default Backup Script In Detail

[Windows]  

// Where is the windows OS installed?
Windows.Install.Drive = C:

// How many log file copies back to do you want to save?
[Logging Options] 
Logging.Max.File.Size = 1048576 ;bytes
Logging.Archive.Size = 3 ;files

[Backup Options]

// Where are you backing up the files FROM and TO
Backup.Drive = C:  

// Where are you backing up the files to?
Backup.Root.Directory = \Shoreware Backup\Backup  

// Where are you backing up the files FROM?
Backup.ShoreWare.Directory = Shoreline Data\  

// How many copies back to do you want to save?
Backup.Archive.Size = 2 ;folders 

[Shoreware File Locations]

// Where is the Shoreline Communication folders located?
ShoreWare.Drive = C: 
ShoreWare.Scripts.Root.Directory = C:\Program Files (x86)\Shoreline Communications\ShoreWare Server\Scripts\
ShoreWare.Scripts.DVM.Root.Directory = C:\Program Files (x86)\Shoreline Communications\ShoreWare Remote Server\Scripts\
ShoreWare.SVCCLI.CMD = /shoretel/bin/svccli
ShoreWare.Root.Directory = \Program Files (x86)\Shoreline Communications\ShoreWare Server
ShoreWare.DVM.Root.Directory = \Program Files (x86)\Shoreline Communications\ShoreWare Remote Server

// Where will the tools be located for the backup procedure?
[Remote Command Tools] 
PLINK.CMD = C:\Program Files (x86)\Shoreline Communications\ShoreWare Server\Scripts\Sample_Backup_Restore\plink
PSCP.CMD = C:\Program Files (x86)\Shoreline Communications\ShoreWare Server\Scripts\Sample_Backup_Restore\pscp

// This is for backing up Voice Switches (50v, 90v etc.)
[VMB] 
VMB.user = admin
VMB.password = ShoreTel
VMB.Backup.Root.Directory = \Shoreware Backup\VMBBackup
VMB.Backup.Folder = VMB

// Place the IP’s of the devices here.
VMB.ip.list = 10.1.1.157 ;comma-separated 

// This is for backing up the conference bridge (SA100, SA400, virtual Conference Bridge)
[UCB] 
UCB.user = admin
UCB.password = ShoreTel
UCB.Backup.Root.Directory = \Shoreware Backup\UCBBackup
UCB.Backup.Folder = UCB

// Place the IP’s of the devices here.
UCB.ip.list = 10.23.139.44;comma-separated 

// This is used to initiate DVS backups from server which this file sits.
[DVS] 
DVS.user = admin
DVS.password = ShoreTel
DVS.Backup.Root.Directory = \Shoreware Backup\DVSBackup
DVS.Backup.Folder = DVS

// Place the IP’s of the devices here.
DVS.ip.list = 10.23.139.44;comma-separated  

Custom Scripts

In my scenario I want to be able to move the backup folders up off to server to a safe location. Below is an explanation of the script (Copy-to-Network-Drive.bat).

D:\Program Files (x86)\Shoreline Communications\ShoreWare Remote Server\Scripts\Sample_Backup_Restore\Copy-to-Network-Drive.bat

@echo off

// This is where my network drive is located
set “backupDir=\\HQ-FS01.XYZ\Mitel Backup\” 

// Create a new folder in my shared drive called HQ-10.100.50.10-backup- AND insert the current date into the filename
md “\\HQ-FS01.XYZ\Mitel Backup\HQ-10.100.50.10-backup-%date:/=%” 

// Copy the files from the backup location D:\Shoreware Backup\Backup\ and move them to the new folder created HQ-10.100.50.10-backup-TODAYSDATE
xcopy “D:\Shoreware Backup\Backup\*” “\\HQ-FS01.XYZ\Mitel Backup\HQ-10.100.50.10-backup-%date:/=%” /s /i 

// Delete any remaining folders in the original backup location
@RD /S /Q “D:\Shoreware Backup\Backup\” 

// Check the network share and make sure there are only 5 backup folders. If there are more than 5 folders, then delete the oldest folder.
for /f “skip=5 delims=” %%a in (‘ dir “%backupDir%\” /b /ad-h /o-d’) do rd /s /q “%backupDir%\%%a”  

Scheduling & Configuring the backup task

It is important that you are able to access the shared drive from the local server first. Make sure you are using a backup user account to practice safe security. I usually also map the location to my server. This way if I am on that server doing work, then I can easily check the backup folder to ensure everything is there and also I can easily grab files or folders if I need to.

my computer details

It is also good practice to add your backup user to your Backup Operators group of your server. This ensures they have the permissions required to be running task scheduler.

Local group permissions

Now we must open Windows Task Scheduler and create our scheduled task. We’re going to run our task daily to ensure we have the most up-to-date copy of our phone system.

Windows Administrative Tools

Task Scheduler

Task Scheduler Window 1
Task Scheduler Window 2

It’s good to schedule the backup outside of the nightly system clean-up that happens automatically. I have chosen 03:30 here as I know all voicemail clean-up will be long done by then.

Task Scheduler Window 3
Task Scheduler Window 4

If you are backing up your HQ, then choose hq_backup_all. Otherwise if you are backing up only your DVS, then you want to use dvm_backup_all.

ShoreTel Backup Scripts
Task Scheduler Window 5

Copy and paste the highlighted in blue and copy it in the “Start in (optional)” field. Be sure to not include the quotation marks.

Task Scheduler Window 6
Task Scheduler Window 7

Plan for the worst

This step is not needed if everything goes well, but I always plan for when the worst possible scenario. This second script is used to start all of the services in the event our backup stops. A good reason for the backup process stopping would be no access to the shared network drive. We want to ensure everything is back online before business starts, so we will run the hq_shoretel-start-svc.bat if we are configuring our hq backup script. If we are running a dvs backup, then we want to use rs_shoretel-start-svc.bat.

Task Scheduler Actions tab
Task Scheduler New Action

This drive may be C:\ depending where you installed your Shoreline Communications folder

D:\Program Files (x86)\Shoreline Communications\ShoreWare Remote Server\Scripts\

ShoreTel backup Scripts directory

OR

ShoreTel backup Scripts directory

Just like above, copy and paste the highlighted in blue and copy it in the “Start in (optional)” field. Be sure to not include the quotation marks.

Windows Task Scheduler Start a Program
Windows Task Scheduler Actions list

Now we want to add our custom script which will copy the backup files/folders and move them to our shared drive.

ShoreTel Backup Scripts Directory

Just like above, copy and paste the highlighted in blue and copy it in the “Start in (optional)” field. Be sure to not include the quotation marks.

Windows Task Scheduler New Action

Hit OK, and then let’s update the settings tab.

Windows Task Scheduler Settings

Now, let’s make sure that we setup the task scheduler to run the task using our backup user. This is done automatically, so we will ensure that it can run the scripts without anyone being logged in.

Windows Task Scheduler General

Once we are all done, we can hit OK and put in the password for our backup user.

Windows Task Scheduler Requesting account credentials

 Configuration is now Complete.

It’s important to test the backup

Once you are in your approved maintenance window (these steps will take down your phone system), then you can run the task on demand to ensure everything works well.

Windows Task Scheduler Main screen - Run program

Here is what it looks like when it runs successfully

First all of the services go disable and start stopping.

Microsoft Windows ShoreTel Services

Then the backup process starts and is placing the files into our ‘Shoreware Backup’ folder.

Backup Directory

Are services are restarted.

Microsoft Windows ShoreTel Services

A new folder is created on our network drive.

Backup Directory

Files are copied over to our new folder.

Backup Directory

The old local drive files in the ‘Shoreware Backup’ folder are deleted.

Backup Directory

You can download the custom script here. Be sure to rename the file from .txt to .bat

That’s it. Please contact us if you have any questions or you would like us to do this for you. You can reach us via out Contact Us page.

For more of our Mitel / ShoreTel related content, go here.