Using the Get-TeamAllChannel Cmdlet to Report Microsoft Teams Channels

Create a Report of All Channels in all Teams

Version 4.6 of the Microsoft Teams PowerShell module includes the Get-TeamAllChannel cmdlet, newly released to allow administrators to get a complete list of all channels (regular, private, and shared) in a team. I wanted to see how useful the new cmdlet is and compare it to the Get-MgTeamChannel cmdlet from the Microsoft Graph PowerShell SDK, which I used to report channels with a wiki tab in the article reporting that Microsoft will no longer auto-provision the Teams wiki for new channels.

The easiest way to test a new cmdlet is to put it to practical use in a script, so I wrote a simple script to:

  • Find all teams.
  • Loop through the teams to find the set of channels in each team.
  • Populate a PowerShell list object with details of the channels.
  • Generate some output.

You can download the script from GitHub. It’s not particularly complex. The normal disclaimers about not using untested code in production apply, but I don’t think you’ll get into much trouble with this code.

Performance

The first thing I noted is that the Get-Team cmdlet (from the 4.6 module) continues to lag in performance when compared to the Get-MgGroup cmdlet. I pointed this out in a previous article, but the additional speed available when using Get-MgGroup is quite stark. My tenant has only 87 teams, and the results of using the two cmdlets is obvious when compared using the Measure-Command cmdlet:

Measure-Command {Get-MgGroup -Filter "resourceProvisioningOptions/Any(x:x eq 'Team')" -All} | Select TotalSeconds

TotalSeconds
------------
   0.3131487

Measure-Command {Get-Team} | Select TotalSeconds

TotalSeconds
------------
  11.4137458

The extra speed doesn’t affect the script much when processing small numbers of teams. It will as the numbers mount, so I choose to go with Get-MgGroup. If you prefer to use the Get-Team cmdlet, you can update the script to use that cmdlet instead. If you do, because the cmdlets use different property names for the group identifier, be sure to amend the call to Get-TeamAllChannel to use $Team.GroupId instead of $Team.Id.

Get-TeamAllChannel Basics

To see all channels in a team, run Get-TeamAllChannel and pass the team (group) identifier:

Get-TeamAllChannel -GroupId b647d5ff-3bda-4333-b768-7990084569b6 

Id             : 19:44ecfd5231b44f4baf7bf664c7048e8e@thread.tacv2
DisplayName    : Project Hydra
Description    : Discussions about the Hydra Project
MembershipType : Private
HostTeamId     : b647d5ff-3bda-4333-b768-7990084569b6
TenantId       : a662313f-14fc-43a2-9a7a-d2e27f4f3478

Id             : 19:5-aYUE7mEEoAmK8gzNZDfT6aTmsyh5DXKAWLNP45aks1@thread.tacv2
DisplayName    : 📔Teams Practices and Architecture
Description    : Discussions about the most productive practices and architectural decisions in
                 Microsoft Teams deployments
MembershipType : Shared
HostTeamId     : b647d5ff-3bda-4333-b768-7990084569b6
TenantId       : a662313f-14fc-43a2-9a7a-d2e27f4f3478

Id             : 19:7d98ec1299da4b35ada086daf162e441@thread.tacv2
DisplayName    : Announcements 📢
Description    : Use this channel to make important team and event announcements.
MembershipType : Standard
HostTeamId     : b647d5ff-3bda-4333-b768-7990084569b6
TenantId       : a662313f-14fc-43a2-9a7a-d2e27f4f3478

Id             : 19:97a16096725040ad84c35430f2ab2c89@thread.tacv2
DisplayName    : General
Description    : Everything you need to know about Office 365
MembershipType : Standard
HostTeamId     : b647d5ff-3bda-4333-b768-7990084569b6
TenantId       : a662313f-14fc-43a2-9a7a-d2e27f4f3478

To see channels of just a specific type, include the MembershipType parameter:

 Get-TeamAllChannel -GroupId b647d5ff-3bda-4333-b768-7990084569b6 -MembershipType Shared


Id             : 19:5-aYUE7mEEoAmK8gzNZDfT6aTmsyh5DXKAWLNP45aks1@thread.tacv2
DisplayName    : 📔Teams Practices and Architecture
Description    : Discussions about the most productive practices and architectural decisions in
                 Microsoft Teams deployments
MembershipType : Shared
HostTeamId     : b647d5ff-3bda-4333-b768-7990084569b6
TenantId       : a662313f-14fc-43a2-9a7a-d2e27f4f3478

Id             : 19:9zvayMx_MW8kWr_gULHIUFyzRBh-ULhb4mBqajGehwQ1@thread.tacv2
DisplayName    : Project Opportunities
Description    :
MembershipType : Shared
HostTeamId     : b647d5ff-3bda-4333-b768-7990084569b6
TenantId       : a662313f-14fc-43a2-9a7a-d2e27f4f3478

Resolving Tenant Names

Microsoft announced the general; availability of shared channels on July 19. By now, all commercial cloud tenants should have access to shared channels and can set up cross-tenant sharing to collaborate with people in other Microsoft 365 organizations. The output of the Get-TeamAllChannel cmdlet includes the identifier of the tenant that hosts a shared channel, but as most people can’t recognize tenant identifiers in their head, the script should resolve tenant identifiers to the human-friendly display name. For example, e662313f-14fc-43a2-9a7a-d2e27f4f3478 becomes Office 365 for IT Pros.

I’ve gone down this path before in an article explaining how to use Azure AD sign-in logs to track access to shared channels hosted in a tenant, so it was easy to reuse the code and call the findTenantInformationByTenantId Graph API to find tenant names. Apart from reporting the host tenant name for each channel, the script also lists the set of tenants hosting channels in its summary (Figure 1).

Running a script using the Get-TeamAllChannel cmdlet to report Teams channels
Figure 1: Running a script using the Get-TeamAllChannel cmdlet to report Teams channels

Get-TeamAllChannel is Quick and Simple

The Get-TeamAllChannel cmdlet is straightforward to use. Its major benefit is that the cmdlet lists all channels in one operation. Its output includes the most important data that administrators might want to know about each channel. Overall, Get-TeamAllChannel is a nice enhancement to the standard Get-TeamChannel cmdlet.


Keep up to date with developments like new cmdlets that appear in the Microsoft Teams PowerShell module by subscribing to the Office 365 for IT Pros eBook. Our monthly updates make sure that our subscribers understand the most important changes happening across Office 365.

One Reply to “Using the Get-TeamAllChannel Cmdlet to Report Microsoft Teams Channels”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.