MS Teams – export team owners

Run the following script to export all team owners and the associated team site

#connecting to Teams

# Get all the teams from tenant  
# Loop through the teams  
foreach($team in $teamColl)  
    Write-Host -ForegroundColor Magenta "Getting all the owners from Team: " $team.DisplayName  
    # Get the team owners  
    $ownerColl= Get-TeamUser -GroupId $team.GroupId -Role Owner  
    #Loop through the owners  
    foreach($owner in $ownerColl)  
              "Name"=$owner.Name ; 
    $obj=New-Object -TypeName psobject -Property $array
    Export-Csv -path "c:\temp\TeamsOwners.csv" -InputObject $obj -Append -NoTypeInformation