Forum Discussion

SushK410's avatar
SushK410
Copper Contributor
Jan 23, 2023
Solved

List of all Teams & channels that have only single owner

Hello,   I would need to list all teams and their channels that have single owner(only 1 user as an owner) using Powershell. It could have atleast count of owners for respective Teams. Can some one...
  • RealTime_M365's avatar
    Jan 24, 2023
    Hi,

    Can you check if the below Powershell Script provides you with the desired output

    # 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
    }
    }

    With Regards,
    Satish U

Resources