Requirements to run scripts (powershell commands before you start):
Set-ExecutionPolicy Unrestricted
Import-Module -name MicrosoftTeams
Connect-MicrosoftTeams
1) export all channels(private and public) from PowerShell of this team unifiedgroup1@Company portal .com.
Find your team name in Teams Admin or the display name that you see in Teams and edit the "YOUR TEAM NAME" part of the script.
$Result = @()
#Get all teams
$AllTeams= Get-Team -DisplayName "YOUR TEAM NAME"
$TotalTeams = $AllTeams.Count
$i = 0
#Iterate teams one by one and get channels
ForEach ($Team in $AllTeams)
{
$i++
Write-Progress -Activity "Fetching channels from $($Team.Displayname)" -Status "$i out of $TotalTeams completed"
Try
{
#Get channels
$TeamChannels = Get-TeamChannel -GroupId $Team.GroupId
#Iterate channels one by one and add to the result array
ForEach ($Channel in $TeamChannels)
{
#Add channel info to the result array
$Result += New-Object PSObject -property $([ordered]@{
TeamName = $Team.DisplayName
TeamVisibility = $Team.Visibility
ChannelName = $Channel.DisplayName
GroupId = $Team.GroupId
ChannelId = $Team.ChannelId
})
}
}
Catch
{
Write-Host "Error occurred for $($Team.Displayname)" -f Yellow
Write-Host $_ -f Red
}
}
#Export the result to CSV file
$Result | Export-CSV "C:\AllTeamChannels.CSV" -NoTypeInformation -Encoding UTF8
Script from https://morgantechspace.com/2021/12/export-channels-and-members-from-all-teams-using-powershell.html
2) Create a private teams channel priv1 from PowerShell under the parent team unifiedgroup1@Company portal .com and make user1 as the owner.
New-TeamChannel -GroupId ObjectId -DisplayName "priv1" -MembershipType Private -Owner UserObjectID
Find the ObjectId in Azure AD > Groups > Choose the group > Under Overview > Object ID
Find the UserObjectID in Azure AD > User > Choose user1 > Under Profile > Object ID
https://learn.microsoft.com/en-us/powershell/module/teams/new-teamchannel?view=teams-ps
3) create a public teams channel pub1 from PowerShell under the parent team unifiedgroup1@Company portal .com and make user1 as the owner.
New-TeamChannel -GroupId ObjectId -DisplayName "pub1" -owner UserObjectId
(see 2) for ObjectId and UserObjectId)
-----------------------
If this is helpful please don't forget to mark as correct answer.