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″
$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}
#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,如需轉載請自行聯系原作者