Get the Team Owners For All The Teams Using PowerShell

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 

    }     

}

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us