Skip to Content
Communication Square LLC Help Center

Get the Team Owners For All The Teams Using PowerShell

Written October 2020. Microsoft changes these admin screens often, so the screenshots below may not match what you see today. The sequence of steps is usually still correct — if something looks wrong, tell us and we'll update it.

Description:

This script is used to get details of all owner of the Teams

Script:

# Get the credentials 

$credentials=Get-Credential 

 # Connect to Microsoft Teams 

Connect-MicrosoftTeams -Credential $credentials 

 # Get all the teams from tenant 

$teamColl=Get-Team 

 # Loop through the teams 

foreach($team in $teamColl) 

{

    Write-Host -ForegroundColor Magenta "Getting all the owners from Team: " $team.DisplayName 

     # Get the team owners 

    $ownerColl= Get-TeamUser -GroupId $team.GroupId -Role Owner 

     

    #Loop through the owners 

    foreach($owner in $ownerColl) 

    { 

        Write-Host -ForegroundColor Yellow "User ID: " $owner.UserId "   User: " $owner.User  "   Name: " $owner.Name 

    }     

}

Last updated on