All scripts
Automation 455
Backup-TeamsMeetingPolicies
Exports every Teams meeting policy configuration to timestamped JSON files, giving you a restore point before making tenant wide meeting policy changes.
Backup-TeamsMeetingPolicies.ps1
<#
.SYNOPSIS
Backs up all Teams meeting policies to JSON.
.DESCRIPTION
Exports the full configuration of every Teams meeting policy to a
timestamped JSON file, giving you a restore point to compare against
or roll back to before making tenant wide meeting policy changes.
.PARAMETER BackupPath
Folder to write the backup files to. Defaults to the current directory.
.EXAMPLE
.\Backup-TeamsMeetingPolicies.ps1 -BackupPath C:\Backups\TeamsPolicies
.NOTES
Requires the MicrosoftTeams module and an active Connect-MicrosoftTeams session.
.AUTHOR
Shehryar Hassan
#>
param(
[string]$BackupPath = (Get-Location).Path
)
$stamp = Get-Date -Format "yyyy-MM-dd_HHmmss"
$folder = Join-Path $BackupPath "TeamsMeetingPolicies_$stamp"
New-Item -ItemType Directory -Path $folder -Force | Out-Null
$policies = Get-CsTeamsMeetingPolicy
foreach ($policy in $policies) {
$safeName = $policy.Identity -replace "[:\\/]", "_"
$file = Join-Path $folder "$safeName.json"
$policy | ConvertTo-Json -Depth 6 | Out-File -FilePath $file -Encoding utf8
}
Write-Host "Backed up $($policies.Count) meeting policy(ies) to $folder" -ForegroundColor Cyan
Read it before you run it, and test in a safe tenant first.