Forum Discussion
Get all Teams and channel information using PowerShell
- Apr 16, 2020
Hi gcjuw84
Here is the link of commands for your reference.
Export all the Teams Channel in Office 365 Tenant
https://gallery.technet.microsoft.com/office/Export-Teams-Channel-de703ad0
With Regards,
Satish U
Hi gcjuw84
Here is the link of commands for your reference.
Export all the Teams Channel in Office 365 Tenant
https://gallery.technet.microsoft.com/office/Export-Teams-Channel-de703ad0
With Regards,
Satish U
That's great thanks. I used the script provided in your second link and added a few lines to also output a count of the channels in each team along with the channel names.
Thanks again for your help.
- Sebastian Di CeccaMay 19, 2020Copper Contributor
Can you post the final script.
I am having trouble with exporting the channels with this script.- gcjuw84May 19, 2020Brass Contributor
No problem, the final script is below. Before running the script you need to make sure you run Connect-MicrosoftTeams and Connect-ExchangeOnline.
Any problems let me know.
$AllTeamsInOrg = (Get-Team).GroupID $TeamList = @() Write-Output "This may take a little bit of time... Please sit back, relax and enjoy some GIFs inside of Teams!" Write-Host "" Foreach ($Team in $AllTeamsInOrg) { $TeamGUID = $Team.ToString() $TeamGroup = Get-UnifiedGroup -identity $Team.ToString() $TeamName = (Get-Team | ?{$_.GroupID -eq $Team}).DisplayName $TeamOwner = (Get-TeamUser -GroupId $Team | ?{$_.Role -eq 'Owner'}).User $TeamUserCount = ((Get-TeamUser -GroupId $Team).UserID).Count $TeamGuest = (Get-UnifiedGroupLinks -LinkType Members -identity $Team | ?{$_.Name -match "#EXT#"}).Name if ($TeamGuest -eq $null) { $TeamGuest = "No Guests in Team" } $TeamChannels = (Get-TeamChannel -GroupId $Team).DisplayName $ChannelCount = (Get-TeamChannel -GroupId $Team).ID.Count $TeamList = $TeamList + [PSCustomObject]@{TeamName = $TeamName; TeamObjectID = $TeamGUID; TeamOwners = $TeamOwner -join ', '; TeamMemberCount = $TeamUserCount; NoOfChannels = $ChannelCount; ChannelNames = $TeamChannels -join ', '; SharePointSite = $TeamGroup.SharePointSiteURL; AccessType = $TeamGroup.AccessType; TeamGuests = $TeamGuest -join ','} } ####### $TestPath = test-path -path 'c:\temp' if ($TestPath -ne $true) {New-Item -ItemType directory -Path 'c:\temp' | Out-Null write-Host 'Creating directory to write file to c:\temp. Your file is uploaded as TeamsDatav2.csv'} else {Write-Host "Your file has been uploaded to c:\temp as 'TeamsDatav2.csv'"} $TeamList | export-csv c:\temp\TeamsDatav2.csv -NoTypeInformation