The estimated reading time 4 minutes

UPDATE 29/03/2020: this article works, but now Teams Module was relaunched and can do quite more things. See my later article:

NOTE: the following actions ONLY shows team groups created in teams, NO converted O365 groups are shown.
For HTML Reports have a look in comments!

Hi everybody,
I am always faced with the question of how to perform certain evaluations for Microsoft teams in Office 365. Today I would like to introduce how an evaluation of the complete O365 environment works on teams groups.
First, I asked myself, how do you find out which O365 groups of teams were created and which from other applications. You will not find too much information on the internet . Unfortunately, the admin interface of Office 365 / Azure AD does not tell if the group was created with Teams / Yammer etc.
That’s why I’ve been working on this topic.
To find out if a group of teams was created, I connect to the Exchange Online via Powershell
I have already integrated this in my ISE, so if you do this often, you can also read my instructions LINK
The PSSession to Exchange Online is mandatory, as it loads all the necessary cmdlets. The ISE can be used for this because it is very easy to make changes to the script etc.
I used the cmdlet: Get-UnifiedGroup. The output of this query is then filtered again.
$teamsgroups = (Get-UnifiedGroup | Where-Object {($_.ProvisioningOption -eq "ExchangeProvisioningFlags:481") -or ($_.ProvisioningOption -eq "ExchangeProvisioningFlags:3552") }


Because a lot of objects returned after running, I chose a “select” for filtering.

$teamsgroups = (Get-UnifiedGroup | Where-Object {($_.ProvisioningOption -eq "ExchangeProvisioningFlags:481") -or ($_.ProvisioningOption -eq "ExchangeProvisioningFlags:3552") } | Select-Object DisplayName,Alias,ProvisioningOption,SharePointSiteUrl,SharePointDocumentsUrl,AccessType,Language,ExchangeGuid,ManagedBy)


Thus, all O365 groups created by the team users can be displayed.
Not bad at all.
Now I also want to get the group members displayed.

Get-UnifiedGroupLinks -Identity 
 -LinkType Members

As far as not very difficult.
So bringing these two steps together is not as easy as it looks like. 
For this I have built the following Powershell script.


    script for showing all office 365 groups created by microsoft teams


    no parameters needed 

    connect to exchange online first
    or see
    Script:       get-allteams-withmembers-0-1.ps1                                      
    Author:       A. Koehler;
    ModifyDate:   18/03/2018                                                        
    Usage:        identify all teams groups in office 365 and get members
    Version:      0.1

#get all groups created with ms teams (filtered ExchangeProvisioningFlag:481)
#raw powershell command: Get-UnifiedGroup | Where-Object {$_.ProvisioningOption -eq "ExchangeProvisioningFlags:481" } | fl
$teamsgroups = (Get-UnifiedGroup | Where-Object {($_.ProvisioningOption -eq "ExchangeProvisioningFlags:481") -or ($_.ProvisioningOption -eq "ExchangeProvisioningFlags:3552") } | Select-Object DisplayName,Alias,ProvisioningOption,SharePointSiteUrl,SharePointDocumentsUrl,AccessType,Language,ExchangeGuid,ManagedBy) 
#notification for powershell
Write-Host "Getting Office 365 Groups created with MS Teams... " -ForegroundColor Green
#generate array for teamsgroups
$teams = @()
#loop to get information
ForEach ($group in $teamsgroups){
  #get-members of group
  $identity = (($group).ExchangeGuid)
  $members = (Get-UnifiedGroupLinks -Identity "$identity" -LinkType Members | Select-Object PrimarySMTPAddress) 
  $owners = (Get-UnifiedGroupLinks -Identity "$identity" -LinkType Owners | Select-Object PrimarySMTPAddress)   
  $member = (($members).primarySMTPAddress) | Out-String -Width 4096
  $owner = (($owners).primarySMTPAddress) | Out-String
  # Adding pscustomobjets entries to array
  $teams += [pscustomobject]@{
    DisplayName   = ($group).DisplayName
    Alias    = ($group).Alias
    AccessType = ($group).AccessType
    Language = ($group).Language
    Members = ("$member")
    Owner = ("$owner")
#out put in GridView (external window)
Write-Host "Display in Grid View Window " -ForegroundColor Green
$teams | Out-GridView -Title "All Office365 Groups created in MS Teams" 
#out put in powershell
#$teams | Format-Table -AutoSize -Wrap  
#erase content of variables
$teams =$null
$member = $null

This reads all groups with members and also the current manager / owner. We have an overview of the current teams groups within the company.
Criticism and feedback is welcome.
Have fun testing.

Print Friendly, PDF & Email
  • Was this Helpful ?
  • yes   no