🔧 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

Bulk Update Teams Fun Settings via Graph PowerShell (Using CSV)

Managing multiple Microsoft Teams settings manually can be tedious for IT admins. If you're looking to enable or restrict fun settings like Giphy, memes, and stickers across many Teams at once, this Graph PowerShell script will automate the job for you.


CSV File Format

Create a CSV file named something like TeamsFunSettings.csv with the following headers and values:

TeamId,AllowGiphy,GiphyContentRating,AllowStickersAndMemes,AllowCustomMemes
a1b2c3d4-5678-90ab-cdef-1234567890ab,true,moderate,true,false
b2c3d4e5-6789-01bc-defa-2345678901bc,false,strict,false,false

Column Name Description
TeamId The unique ID of the Microsoft Team.
AllowGiphy Accepts true or false to enable/disable Giphy integration.
GiphyContentRating Accepts moderate or strict to control GIF appropriateness.
AllowStickersAndMemes Enables/disables stickers and default memes.
AllowCustomMemes Controls if users can upload custom memes.

📌 Note: Values are case-insensitive but should be valid (true/false, moderate/strict).


The Script: Bulk Update Fun Settings for Teams from CSV

# Import CSV
$teams = Import-Csv -Path "C:\Path\To\TeamsFunSettings.csv"
                                
foreach ($team in $teams) {
    Write-Host "Updating fun settings for Team ID: $($team.TeamId)" -ForegroundColor Cyan
                                    
    # Create hashtable for fun settings
    $funSettings = @{
        allowGiphy = [bool]$team.AllowGiphy
        giphyContentRating = $team.GiphyContentRating
        allowStickersAndMemes = [bool]$team.AllowStickersAndMemes
        allowCustomMemes = [bool]$team.AllowCustomMemes
    }
                                    
    try {
        Update-MgTeam -TeamId $team.TeamId -FunSettings $funSettings
        Write-Host "Updated successfully." -ForegroundColor Green
    }
    catch {
        Write-Host "Failed to update team $($team.TeamId): $_" -ForegroundColor Red
    }
}
                            

How the Script Works

  1. CSV Input
  2. The script reads from a CSV file with the appropriate columns shown above.

  3. Iterative Processing
  4. It loops through each row, constructs a -FunSettings hashtable, and applies it using Update-MgTeam.

  5. Graph PowerShell Cmdlet Used
  6. Update-MgTeam: Updates the team’s settings, including fun settings.

  7. Error Handling
  8. Uses try/catch blocks to catch and report errors for each individual team, ensuring the script continues running.


Further Enhancements

Here are a few ways to make the script even more robust:

Enhancement Description
Add Logging Export success/failure info to a log file.
Validate Inputs Check CSV for missing or invalid values before applying updates.
Parallel Execution Use background jobs or runspaces for faster processing on large tenants.
Dry-Run Mode Add a flag to simulate updates before actually applying them.
Multi-setting Update Expand the script to update MemberSettings, MessagingSettings, or GuestSettings alongside FunSettings.

Possible Errors & Solutions

Error Cause Solution
Access Denied or Forbidden Missing permissions Ensure the Graph app/token has TeamSettings.ReadWrite.All permission.
Invalid request: giphyContentRating Wrong content rating value Use only moderate or strict (case-sensitive).
Object not found Incorrect Team ID Validate that the TeamId in the CSV exists in your tenant.
Cannot convert 'true' to type 'Boolean' Value in CSV is a string Use [bool] type cast as shown in the script to fix this.
Throttling/Too many requests Large number of updates in short time Add Start-Sleep -Seconds 1 between requests or handle 429 retries.

Frequently Asked Questions

  • Where can I find the Team ID?
  • You can use the following Graph PowerShell command:

    Get-MgTeam | Select-Object Id, DisplayName
  • What values are accepted for GiphyContentRating?
  • Only two values are valid:

    • moderate (default)
    • strict
  • Can I disable only custom memes but allow stickers?
  • Yes. Just set:

    AllowStickersAndMemes,true
    AllowCustomMemes,false
                                    
  • Is there a way to confirm the settings were applied?
  • Yes. Run:

    Get-MgTeam -TeamId "your-team-id" | Select-Object -ExpandProperty FunSettings
  • Does this script affect private channels?
  • No. Fun settings apply to the team as a whole, not to individual channels.


Conclusion

This Graph PowerShell script streamlines the management of Teams fun settings across your organization. With a well-structured CSV and a few lines of PowerShell, you can enable or restrict Giphy, memes, and stickers in bulk—saving time and ensuring compliance with company policies.

Next Steps:

  • Roll it out in stages (pilot Teams first).
  • Consider combining it with governance policies.
  • Add logging or integration into scheduled tasks for ongoing maintenance.

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