🔧 New: User Management Graph PowerShell Toolkit

Simplify user tasks like bulk creation, updates, password resets, deletions, license checks & more — all from one place.

🚀 Launch Toolkit

Fetch and Email Microsoft Teams Fun Settings

Managing user experience options in Microsoft Teams is vital for maintaining a balance between collaboration and control. Administrators often need to review Fun Settings (like Giphy, memes, and stickers) across all Teams to ensure that these features align with organizational policies.

With Microsoft Graph PowerShell, you can easily fetch these settings from all Teams in your tenant and automatically email the report to your administrator for auditing and governance purposes.


i) The Script


  
    $AdminUPN = "admin@contoso.com"   
  
    $results=@()
    foreach ($team in $allTeams) {
        try {
             # Retrieve Fun Settings for each team
             $teamDetails=Get-MgTeam -TeamId $team.Id
             # Extract boolean values and content rating
             $giphyStatus=$teamDetails.FunSettings.allowGiphy
             $giphyRating=$teamDetails.FunSettings.giphyContentRating
             $stickersStatus=$teamDetails.FunSettings.allowStickersAndMemes
             $customMemeStatus=$teamDetails.FunSettings.allowCustomMemes
             # Add to result list
             $results +=[pscustomobject]@{
                    "Team Name" =$team.DisplayName
                    "AllowGiphy" =$giphyStatus
                    "GiphyContentRating" =$giphyRating
                    "AllowStickersAndMemes" =$stickersStatus
                    "AllowCustomMemes" =$customMemeStatus
            }
            }
          catch {
              Write-Warning "Failed to retrieve fun settings for team: $($team.DisplayName)"
          }
      }
   
     $ReportPath ="$env:TEMP\TeamsFunSettingsReport.csv"
      $results | Sort-Object "Team Name" | Export-Csv -Path $ReportPath -NoTypeInformation -Encoding UTF8

      $Subject="Microsoft Teams Fun Settings Report — $(Get-Date -Format 'yyyy-MM-dd')"
      $Body=@"
                                                          Hello Admin,<br><br>
Attached is the latest report of Microsoft Teams Fun Settings across all teams in the tenant.
Total Teams Analyzed: <b>$teamCount</b><br><br> Fields include: AllowGiphy, GiphyContentRating, AllowStickersAndMemes, and AllowCustomMemes.<br><br> Regards,<br> Graph PowerShell Script "@ # Read and attach the CSV $AttachmentContent = [System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes($ReportPath)) $Attachments = @( @{ "@odata.type" = "#microsoft.graph.fileAttachment" Name = [System.IO.Path]::GetFileName($ReportPath) ContentBytes = $AttachmentContent } ) # Build email payload $Message = @{ Message = @{ Subject = $Subject Body = @{ ContentType = "HTML" Content = $Body } ToRecipients = @( @{ EmailAddress = @{ Address = $AdminUPN } } ) Attachments = $Attachments } SaveToSentItems = "true" } # Send email to the admin Send-MgUserMail -UserId $AdminUPN -BodyParameter $Message Write-Host "Teams Fun Settings report emailed successfully to $AdminUPN"

ii) How the Script Works

  1. Configuration – You specify the administrator’s email address ($AdminUPN) to receive the report.
  2. Graph Connection – The script connects to Microsoft Graph using the Team.Read.All and Mail.Send scopes.
  3. Fetch All Teams – The script retrieves all Microsoft Teams in the tenant using Get-MgTeam -All.
  4. Retrieve Fun Settings For each team, the script uses Get-MgTeam -TeamId to get detailed Fun Settings, including:
    • AllowGiphy
    • GiphyContentRating
    • AllowStickersAndMemes
    • AllowCustomMemes
  5. Export Report – Results are exported to a CSV file saved in the system’s temporary folder
  6. Email Report – The script attaches the CSV file and emails it to the administrator with a summary of total Teams processed.

iii) Further Enhancements

  • Include Additional Settings – Extend the script to include messaging, member, or guest access settings for each Team.
  • Add Owner Details – Retrieve and include Team owner names for ownership visibility.
  • Automation – Schedule this script to run weekly or monthly using Task Scheduler or Azure Automation.
  • Policy Comparison – Compare the report against baseline compliance configurations
  • Visual Summary – Convert the CSV data to charts or Power BI dashboards for governance visibility.

iv) Possible Errors & Solutions

Error Cause Solution
Insufficient privileges to complete the operation Missing Microsoft Graph permissions. Use Connect-MgGraph -Scopes "Team.Read.All","Mail.Send".
Send-MgUserMail : Resource not found The $AdminUPN specified is not a valid mailbox. Replace $AdminUPN with a valid mailbox-enabled account.
Access Denied while fetching Team details The connected account doesn’t have sufficient privileges on some Teams. Use an account with Teams Administrator or Global Administrator rights.
Empty CSV File The tenant might not have any Teams or Graph throttled the call. Retry after a few minutes or validate Teams availability.

v) Conclusion

This Graph PowerShell script provides administrators with an automated way to review Microsoft Teams Fun Settings across the tenant. By fetching details such as Giphy permissions, meme settings, and stickers, it helps ensure that collaboration features align with company policy.

With automated emailing and scheduling, this script makes Teams governance effortless, delivering consistent visibility to administrators while saving time on manual checks.


Graph PowerShell Explorer Widget

20 Graph PowerShell cmdlets with easily accessible "working" examples.


Permission Required

Example:


                


                


                

© m365corner.com. All Rights Reserved. Design by HTML Codex