Backing up Lync Archiving Data to FTP

The Archiving server role in Lync 2010 does a pretty decent job of living up to it’s namesake in archiving messaging data. Whether on a SAN or locally attached, disk space is not infinite. This means we can’t keep data in SQL forever, even if we need to keep the data around. One option natively built into the Lync PowerShell Cmdlets is Export-CSArchivingData which does exactly what it says and exports archiving data to EML format for backup or viewing. My problem is that this is a manual process and needs human intervention and/or interaction. To fix this, I did what I tend to do best and automated it via PowerShell.

That brings us to Archive-CsDataOffsite.ps1 which is built to be run as a Scheduled Task within Windows that runs as often as needed (daily, monthly, quarterly, etc.). After setting a couple configuration options within the script, it will automatically export Lync archiving data to a folder, zip it up, and upload it to a specified FTP server. To accomplish this, I have made use of the PSFTP PowerShell Module created by Michal Gajda and available on the TechNet Script Center here. I have also used the command line version of 7zip (Which can be downloaded here); as I find the native .NET interface for ZIP archive creation can be plagued by permissions issues.

The configuration options for the script are shown below and will need to be tailored to your environment. They are pretty straight forward and self explanatory. The other other changes to configure would be to uncomment Lines 50 and 59 to have the script delete the exported data and/or ZIP archives from the local machine where the script is run.

As with all of the stuff I post, PLEASE PLEASE PLEASE test and verify before you deploy this. I’m not responsible for any and all problems that may arise from using this in a testing or production environment. The script download link can be found below.


Download Archive-CsDataOffsite.ps1

Necessary Prerequisites:

PSFTP Download Page

7zip Command Line Download Page


Creative Commons License
Archive-CsDataOffsite.ps1 by Christopher Cook is licensed under a Creative Commons Attribution 3.0 Unported License.

Leave a Reply

Your email address will not be published. Required fields are marked *