Backing up Microsoft Lync 2013 is typically accomplished through the use of several PowerShell commands.  These commands can be combined into a single PowerShell script and run nightly as a scheduled task.  The individual commands are documented and can be found within the TechNet library and are referenced below.  Pre-built backup scripts can also be found within the TechNet Gallery.  This article focuses specifically on the backup and restoration of user data.

User Backup Process

User data can be backed up through the use of the export-csuserdata command.  This command exports all user data from a pool into a pair of XML documents within a zipped archive.  In order to get a complete backup of all user data, this command will need to be run at least once for each pool in your organization.  The command can be run as seen below to export all user data at once, or can be run with the –UserFilter parameter to backup only the user data for a single user.


Export-CsUserData -PoolFqdn "atl-cs-001.litwareinc.com" -FileName "C:\Logs\ExportedUserData.zip"
Export-CsUserData -PoolFqdn "atl-cs-001.litwareinc.com" -FileName "C:\Logs\ExportedUserData.zip" -UserFilter kenmyer@litwareinc.com

User Restoration Process

There are two closely related PowerShell commands that can be used for the importing of user data, Import-CSUserData and Update-CSUserData.  Both have the ability to restore user data for a single user, or all users of a pool, but beyond that they have distinct differences.


Import-CSUserData is used when you need to completely overwrite the user data with the copy from the backup.  It is important to note that after this command it runs, the user will not see the effect of the change until the Front End service on all servers within the pool has been restarted.


Import-CsUserData -PoolFqdn "atl-cs-001.litwareinc.com" -FileName "C:\Logs\ExportedUserData.zip"
Import-CsUserData -PoolFqdn "atl-cs-001.litwareinc.com" " -FileName "C:\Logs\ExportedUserData.zip" -UserFilter kenmyer@litwareinc.com


This command is used when the data from the backup needs to be merged with the existing data in the pool.  Unlike Import-CSUserData, this command does not require any service restarts to be effective, however, it should be noted that due to the merging. It is more resource intensive, which can result in delays when the operation is performed for many users at once.


Update-CsUserData -Filename "C:\Logs\ExportedUserData.zip"
Update-CsUserData -Filename "C:\Logs\ExportedUserData.zip" -UserFilter "kenmyer@litwareinc.com"