Simplify user tasks like bulk creation, updates, password resets, deletions, license checks & more — all from one place.
🚀 Launch ToolkitMicrosoft Teams administrators often need to verify if team members have the ability to edit or delete their messages. Doing this manually through the Teams Admin Center or by individually querying each team through Graph PowerShell can be frustrating and time-consuming—especially in tenants with a large number of teams.
This Graph PowerShell script provides a centralized report by looping through all Teams in your tenant and fetching their message settings. It eliminates the admin pain point of reviewing these settings one team at a time and delivers the results in a clean, readable format.
Connect-MgGraph -Scopes "TeamSettings.Read.All"
# Get all Teams (Unified Groups with Teams provisioned)
$teams = Get-MgGroup -Filter "resourceProvisioningOptions/Any(x:x eq 'Team')" -All
foreach ($team in $teams) {
try {
$teamSettings = Get-MgTeam -TeamId $team.Id
$teamName = $team.DisplayName
$editSetting = $teamSettings.MessagingSettings.AllowUserEditMessages
$deleteSetting = $teamSettings.MessagingSettings.AllowUserDeleteMessages
Write-Output "Team: $teamName"
Write-Output " Allow User Edit Messages: $editSetting"
Write-Output " Allow User Delete Messages: $deleteSetting"
Write-Output ""
}
catch {
Write-Warning "Failed to retrieve settings for team: $($team.DisplayName)"
}
}
💡 Note: Ensure you are connected to Microsoft Graph with the appropriate scope: TeamSettings.Read.All
You can take this script further by:
Error | Cause | Solution |
Failed to retrieve settings for team: | Missing permissions or API failure | Ensure the app has TeamSettings.Read.All or higher, and you’re using the latest Graph PowerShell SDK |
Get-MgTeam : Insufficient privileges | Lack of permission consent | Consent to Graph API permissions at the tenant level |
Empty Output for Some Teams | Settings not provisioned or legacy teams | Cross-check if those teams are fully provisioned and active |
This Graph PowerShell script helps admins quickly audit messaging permissions across all Microsoft Teams in a tenant. Instead of jumping from one team to another in the Teams Admin Center, this script provides a consolidated view—making governance easier, faster, and more reliable.
Let this become a part of your regular audit routine or use it as a foundation for building more powerful Teams compliance reports.
© m365corner.com. All Rights Reserved. Design by HTML Codex