Teams Updates PowerShell Module for Private Channels

Teams PowerShell Module 1.0.18 Supports Private Channels

Microsoft released support for private channels on November 4 (also see this note about managing private channels). Support for PowerShell access to private channels is not yet available in the publicly available version of the Teams PowerShell module. Instead, if you want to work with private channels through PowerShell, you must install the latest version of the Teams module from the PowerShell test gallery. You need to run version 1.0.18 or better to manage private channels (Figure 1).

The right version of the Teams PowerShell module for Private Channel support
Figure 1: The right version of the Teams PowerShell module for Private Channel support

New and Updated Cmdlets for Private Channels

The following cmdlets are updated to support private channels:

  • New-TeamChannel: New MembershipType and Owner parameters to set a channel to be private and assign an initial owner.
  • Set-TeamChannel: Now able to update the description or display name of a private channel.
  • Get-TeamChannel: Updated with new MembershipType parameter to only return the set of private channels.
  • Remove-TeamChannel: Can remove a private channel. Use with care!

Three new cmdlets are available to manage the membership of private channels:

  • Add-TeamChannelUser: Add a user to a private channel. You can add someone as an owner or member.
  • Get-TeamChannelUser: Lists the members of a private channel.
  • Remove-TeamChannelUser: Deletes a member from a private channel.

Group Identifier

Like everything to do with Teams when working through PowerShell, you need to know the group identifier of the team hosting the private channel to use any of these cmdlets. The object identifier for a team is easily fetched. In this example, we fetch the group identifier for the team with the display name “Corporate Acquisition Planning” and store it in the $GroupId variable.

Adding a New Private Channel

The New-TeamChannel cmdlet creates a new private channel if you specify that the MembershipType parameter is Private. Remember to add an owner selected from the membership of the team.

After creating a new private channel, you build out its membership by adding a subset of the members of the team with the Add-TeamChannelUser cmdlet. Specify -Role Owner for the members who will be owners of the private channel. You must first add someone as a member before you can add them as an owner. Everyone in the channel can be an owner, if that’s what you want. Again, the private channel is identified with its display name.

Channel Membership

Use the Get-TeamChannelUser cmdlet to return the membership of a private channel. Note that you identify the private channel using its display name.

Use the Remove-TeamChannelUser cmdlet to remove an owner or member from a private channel:

Listing Channels

If you run Get-TeamChannel to list the channels in a team, you see all channels without any indication of which are private, and which are public unless you output the MembershipType property:

To select a specific type of channel, use the MembershipType parameter to state the kind of channel you want to return:

Updating and Removing a Channel

There’s no way to run a command to change a channel type from Private to Standard or vice versa. All you can do with Set-TeamChannel is update the display name or description.

The Remove-TeamChannel cmdlet doesn’t give any warning or seek confirmation when it removes a private channel (and the underlying SharePoint site).


Need examples of how to use PowerShell to solve real-life administration challenges with Teams? Check out the “Managing Groups and Teams with PowerShell” chapter in the Office 365 for IT Pros eBook. It’s always easier to create a script based on a working example!

Advertisements

3 Replies to “Teams Updates PowerShell Module for Private Channels”

Leave a Reply

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