To locate all of the private channel users whose mailboxes you would need to include in a content search or eDiscovery, follow these steps:
- Connect to Microsoft Teams using the Connect-MicrosoftTeams cmdlet.
- Locate the Team group object ID using $Team = Get-Team -DisplayName "Team Name".
- Locate the Team's private channels using $Channels = Get-TeamChannel -GroupId $Team.GroupId | ? {$_.MembershipType -eq "Private"} .
- Locate the Team's private channel users with $Users = ($Channels | % { Get-TeamChannelUser -GroupId $Team.GroupId -DisplayName $_.DisplayName}).User | Sort -Unique, as shown here: