Often I get asked what should someone backup for Lync Server 2013 and thankfully the list of items hasn’t changed that much from Lync Server 2010 to Lync Server 2013. I wrote an article on how to backup and recovery Lync Server 2010 and I highlighted a few major items:
- CMS Database
- LIS Database
- Response Groups
- User Data
This script has been tested with both Standard and Enterprise Edition pools and on Windows Server 2012.
# Export Script for Backup
# Created By Richard Brynteson
# Avtex 2013
# Import Lync Module
Import-Module “C:\Program Files\Common Files\Microsoft Lync Server 2013\Modules\Lync\Lync.psd1″
###Variables To Set
$folderPath = “D:\Backup\FromMSP”
$lengthOfBackup = “-10″
$drFolderPath = “\\drserver.domain.com\FromMSP$”
$poolFQDN = “pool.domain.com”
###Done
#Production – Delete Older Than x Days
get-childitem $folderPath -recurse | where {$_.lastwritetime -lt (get-date).adddays($lengthOfBackup) -and -not $_.psiscontainer} |% {remove-item $_.fullname -force }
#Production – Delete Empty Folders
$a = Get-ChildItem $folderPath -recurse | Where-Object {$_.PSIsContainer -eq $True}
$a | Where-Object {$_.GetFiles().Count -eq 0} | Remove-Item
#Production – Get Date and Create Folder
$currDate = get-date -uformat “%a-%m-%d-%Y-%H-%M”
New-Item $folderPath\$currDate -Type Directory
#Delete Older Than x Days – DR Side
get-childitem $drFolderPath -recurse | where {$_.lastwritetime -lt (get-date).adddays($lengthOfBackup) -and -not $_.psiscontainer} |% {remove-item $_.fullname -force }
#Delete Empty Folders – DR Side
$a = Get-ChildItem $drFolderPath -recurse | Where-Object {$_.PSIsContainer -eq $True}
$a | Where-Object {$_.GetFiles().Count -eq 0} | Remove-Item
#Message Out
Write-Host -ForegroundColor Green “Backup to server in progress”
#Export CMS/XDS and LIS
Export-CsConfiguration -FileName $folderPath\$currDate\XdsConfig.zip
Export-CsLisConfiguration -FileName $folderPath\$currDate\LisConfig.zip
#Export RGS Config
Export-CsRgsConfiguration -Source “service:ApplicationServer:$poolFQDN” -FileName $folderPath\$currDate\RgsConfig.zip
#Export User Information
Export-CsUserData -PoolFqdn $poolFQDN -FileName $folderPath\$currDate\UserData.zip
Write-Host -ForegroundColor Green “XDS, LIS, User and RGS backup to server is completed. Files are located at $folderPath\$currDate”
Write-Host -ForegroundColor Green “Please make sure to export Voice Configuration”
#Copy Files to DR Server
robocopy $folderPath $drFolderPath /COPY:DATSO /S
如何使用脚本
我做了它,我可以简单的使用和重用。首先,除上述一个文件名LyncBackupScript.ps1和它保存到D:\备份。
在变量方面,我有四个。
第一个是备份文件实际上是要存储的位置。
因此,这个脚本是在D:\备份,然后我要去我的文件存储在D:\备份\ FromMSP中。
在该文件夹中,该脚本将创建一个文件夹中。备份的长度是多少个文件在服务器上,该数字必须是负数,像-10天。
像上面DR文件夹路径。池的名称是您要备份池。
作为计划的任务,你将要安排此脚本。所以,你预定的任务,会是这样的:
powershell.exe -FileName d:\backup\lyncbackupscript.ps1
所以去“管理工具”|“计划任务。创建一个新的任务(的Lync备份为例)。以上的可执行文件的路径,将其设置为每天安排。在向导,设置时间,确保编辑备份脚本。您将要更改设置允许脚本随时运行。
当你这样做,你将需要作出任何用户要运行脚本作为批处理权限登录。
为此,您可以通过本地安全策略更改一下权限。在权限方面,你会需要RTCUniversalServerAdmins组的成员执行。
本文转自cantgis 51CTO博客,原文链接:http://blog.51cto.com/cantgis/1175831,如需转载请自行联系原作者