M365 – Teams Guest Access Audit (PowerShell)

Below is a ready-to-use script. Review and adapt variables to your environment.

Connect-MicrosoftTeams
Get-Team | ForEach-Object {
  $t = $_
  Get-TeamUser -GroupId $t.GroupId -Role Guest | 
    Select @{n='Team';e={$t.DisplayName}}, User, Role
} | Export-Csv teams_guests.csv -NoTypeInformation
  

← Back to SQL