Saturday, February 21, 2015

Lync BackUP Powershell Script

This Script is to take the Back up of Lync using Power Shell Script .

$BackupPath = "C:\BackupLync" ( Change the Backup path according to your's)
$FileStore = "\\Lync01.Contoso.com\Lyncshare" ( Change File store according to Your's)
$Pool = "lyncpool01.Contoso.Com"        ( Change the pool name)    
$SQLinstance = "lyncrtc.Contoso.com\rtc" ( Change te Sql instance )
$RemoteLocation = "\\lync02\C$\BackupLync" ( Change the Back Up Location)

md $BackupPath\"backup_$((get-date).toString('ddMMyyyy'))"

Export-CsConfiguration -FileName $BackupPath\"backup_$((get-date).toString('ddMMyyyy'))"\Config.zip

Export-CslisConfiguration -FileName $BackupPath\"backup_$((get-date).toString('ddMMyyyy'))"\CsLISconfig.zip

CD "C:\Program Files\Common Files\Microsoft Lync Server 2010\Support\"
./DBImpExp.exe /hrxmlfile:"$BackupPath\"backup_$((get-date).toString('ddMMyyyy'))"\UserData.xml" /sqlserver:$SQLinstance

CD "C:\Program Files\Microsoft Lync Server 2010\ResKit\"
Import-Module .\RgsImportExport.ps1
Export-CsRgsConfiguration -Source applicationserver:$Pool –FileName $BackupPath\"backup_$((get-date).toString('ddMMyyyy'))"\RGSconfig.zip

md $BackupPath\"backup_$((get-date).toString('ddMMyyyy'))"\FileStore
xcopy /E /C /H /K /O $FileStore $BackupPath\"backup_$((get-date).toString('ddMMyyyy'))"\FileStore > $BackupPath\"backup_$((get-date).toString('ddMMyyyy'))"\FileStore\FileStoreFileCopyList.txt

Get-CsTopology -AsXML | Out-File $BackupPath\"backup_$((get-date).toString('ddMMyyyy'))"\CSTopology.xml

md \\lync01\C$\BackupLync\"backup_$((get-date).toString('ddMMyyyy'))"
xcopy /E /C /H /K /O $BackupPath\"backup_$((get-date).toString('ddMMyyyy'))" $RemoteLocation\"backup_$((get-date).toString('ddMMyyyy'))"


Any Comments are Welcome :) 


No comments:

Post a Comment