Forum Discussion
SushK410
Jan 23, 2023Copper Contributor
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 kindly help me with the script?
Regards,
Sush
- 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
2 Replies
Sort By
- 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- mLiw26Copper Contributor
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,