SOLVED

List of all Teams & channels that have only single owner

Copper Contributor

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 kindly help me with the script?

 

Regards,

Sush

2 Replies
best response confirmed by SushK410 (Copper Contributor)
Solution
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

@RealTime_M365 

Hi,

 

Is there a way to query for MS Teams Groups within our Tenant with ONLY ONE OWNER that includes the owner's name/email on the report and export the results (csv)?

I tried your script which is very helpful specially for large tenant with thousands of MS Teams groups.

 

Thanks,

1 best response

Accepted Solutions
best response confirmed by SushK410 (Copper Contributor)
Solution
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

View solution in original post