Hi @frob
Thanks for visiting our forum. Our forum focuses on Microsoft Teams, which is the hub for team collaboration in Office 365. Based on your description, this problem is related to Teams script
development, which we do not support. The following suggestion only for your reference.
I have found a script about how to get a list of all Teams with associated channels.
# Connect to Microsoft Teams
Connect-MicrosoftTeams
# List all Teams and all Channels
$ErrorActionPreference = "SilentlyContinue"
$allteams = Get-Team
$object = @()
foreach ($t in $allteams) {
$members = Get-TeamUser -GroupId $t.GroupId
$owner = Get-TeamUser -GroupId $t.GroupId -Role Owner
$channels = Get-TeamChannel -GroupId $t.GroupId
$object += New-Object -TypeName PSObject -Property ([ordered]@{
'Team'= $t.DisplayName
'GroupId' = $t.GroupId
'Owner' = $owner.User
'Members' = $members.user -join "`r`n"
'Channels' = $channels.displayname -join "`r`n"
})
}
Write-Output $object
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.