• Home
  • BLOGS

Menu
  • Home
  • BLOGS
08 December 2020

MS Teams – export team owners

Written by Ryan Wilson

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

#connecting to Teams
Connect-MicrosoftTeams

# Get all the teams from tenant  
$teamColl=Get-Team  
 
# 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)  
    {  
    $array=[ordered]@{
              "Owner"=$owner.User;
              "Name"=$owner.Name ; 
 
    } 
    $obj=New-Object -TypeName psobject -Property $array
    Export-Csv -path "c:\temp\TeamsOwners.csv" -InputObject $obj -Append -NoTypeInformation     
}
}

Leave a Reply

Cancel reply

Recent Posts

  • MS Teams – export team owners
  • Deploy AppLocker in Intune- Block CMD and PowerShell
  • Autopilot Hybrid Joined device built outside the corporate network
  • Add a SharePoint site as a custom app within Teams
  • Query all MS Teams and Export list of guests added to each Team site
  • MS Flow – adding timestamp in the middle of a filename whilst retaining file extension
  • MS Flow to export outlook attachment into a Teams channel and notify users with an adaptive card
  • Unlicense Office suite using last 5 characters
  • Azure Information Protection – We were not able to find the Information Rights Management template.
  • Intune – Chrome homepage remediation failed Error: 0x87d1fde8

Recent Comments

  • Ged on MS Flow to export outlook attachment into a Teams channel and notify users with an adaptive card
  • film on Autopilot Hybrid Joined device built outside the corporate network
  • Ryan Wilson on Azure Information Protection – We were not able to find the Information Rights Management template.
  • BurtonMBrohl on Azure Information Protection – We were not able to find the Information Rights Management template.
  • Ryan Wilson on Azure Information Protection – We were not able to find the Information Rights Management template.
  • RayeXDuesing on Azure Information Protection – We were not able to find the Information Rights Management template.
  • TroyTHulette on Azure Information Protection – We were not able to find the Information Rights Management template.
  • NildaZAdamos on Azure Information Protection – We were not able to find the Information Rights Management template.
  • Ryan Wilson on Azure Information Protection – We were not able to find the Information Rights Management template.
  • NoahVSolak on Azure Information Protection – We were not able to find the Information Rights Management template.

Archives

  • December 2020
  • November 2020
  • October 2020
  • August 2020
  • June 2020
  • May 2020
  • February 2020
  • January 2020
  • December 2019
  • July 2019

Categories

  • IT Blogs (19)
© Copyright 2017. Theme by BloomPixel.