Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
107 lines (83 sloc) 4.32 KB
Creates backup of various components of a Skype for Business environment
This script will back up various components of a Skype for Business environment
including user data, topology, voice routing information, and response groups settings.
Enter a UNC path to a file share to save the backup data.
Backup-SkypeServer.ps1 -FileShare "\\SERVER\FILESHARE"
This command will back up the Skype environment to \\SERVER\FILESHARE.
Written by Jeff Brown
Any and all technical advice, scripts, and documentation are provided as is with no guarantee.
Always review any code and steps before applying to a production system to understand their full impact.
Version Notes
V1.0 - 2/03/2016 - Initial Version
V1.1 - 3/04/2016 - Removed erroneous $FileShare settings in Variables section
V2.0 - 10/4/2017 - Updated name to Backup-SkypeServer
#************************ Parameters ****************************************
[Parameter(Position=0, Mandatory=$true, HelpMessage = "Enter a network/UNC path to save the backup files.")]
if ((Test-Path -Path $_) -eq $true) {return $true} else {Throw "$_ is not accessible or a valid network path."}
#************************** Variables ****************************************
# Get various date fields
[string]$RemoveDate = ((Get-Date).AddDays(-30))
[string]$Now = Get-Date -UFormat %m-%d-%Y_%H%M%S
[string]$BackupPath = "$FileShare\$Now"
# Gets all Front End User Pools in the Environment
[array]$AllUserPools = @((Get-CsService -UserServer).PoolFqdn)
#************************** Main Code ****************************************
# Remove back ups older than 30 days
# Adjust the variable $RemoveDate to your preference
Write-Verbose -Message "Deleting Backups in $FileShare older than $RemoveDate"
Get-ChildItem -Path $FileShare | Where-Object {$_.LastWriteTime -lt $RemoveDate} | Remove-Item -Recurse
# Creates backup directory for current backup if it does not exist
if ((Test-Path -Path $BackupPath) -eq $false)
Write-Verbose -Message "Creating backup directory $BackupPath"
New-Item -Path $BackupPath -ItemType Directory | Out-Null
# Export Common Items to all Pools
Write-Verbose -Message "Exporting Topology"
Export-CsConfiguration -FileName "$BackupPath\"
(Get-CsTopology -AsXml).ToString() > "$BackupPath\TopologyBackup.xml"
Write-Verbose -Message "Exporting Location Information Server"
Export-CsLisConfiguration -FileName "$BackupPath\"
Write-Verbose -Message "Exporting Dial Plans"
Get-CsDialPlan | Export-Clixml -Path "$BackupPath\DialPlan.xml"
Write-Verbose -Message "Exporting Voice Policies"
Get-CsVoicePolicy | Export-Clixml -Path "$BackupPath\VoicePolicy.xml"
Write-Verbose -Message "Exporting Voice Routes"
Get-CsVoiceRoute | Export-Clixml -Path "$BackupPath\VoiceRoute.xml"
Write-Verbose -Message "Exporting PSTN Usage"
Get-CsPstnUsage | Export-Clixml -Path "$BackupPath\PSTNUsage.xml"
Write-Verbose -Message "Exporting Voice Configuration"
Get-CsVoiceConfiguration | Export-Clixml -Path "$BackupPath\VoiceConfiguration.xml"
Write-Verbose -Message "Exporting Trunk Configuration"
Get-CsTrunkConfiguration | Export-Clixml -Path "$BackupPath\TrunkConfiguration.xml"
# Export Pool Specific Response Group Settings and User Data
foreach ($Pool in $AllUserPools)
Write-Verbose -Message "Exporting $Pool Response Groups"
Export-CsRgsConfiguration -Source “ApplicationServer:$Pool-FileName "$BackupPath\$"
Write-Verbose -Message "Exporting $Pool User Data"
Export-CsUserData -PoolFqdn $Pool -FileName "$BackupPath\$"
} # End of foreach ($Pool in $AllUserPools)
You can’t perform that action at this time.