Teams: PowerShell script to get the list of Teams associated with a dedicated user

Fabrice Romelard

Teams: PowerShell script to get the list of Teams associated with a dedicated user

A basic question could be to get all the information associated with one user account in the Office 365 Teams like:

  • Which are the Teams he can connect?
  • What are the permission set associated with these Teams?
  • What are the cannel placed into these Teams?
  • What is the configuration of these Teams?

A solution could be to use the PowerShell module developed around Teams:


That solution is quite limited in term of action, but those questions can get answer with.

To do that I created a simple PowerShell script in which you can change the login to connect and login of people you are questioning. To execute that script you need to have high level permissions and a Teams license associated to the used account too.


Import-Module MicrosoftTeams

#$cred = Get-Credential
#$username = $cred.UserName
#Get-Command -Module MicrosoftTeams 

[string]$username = "YourAdminAccount@yourdomain.com"
[string]$PwdTXTPath = "C:\SECUREDPWD\ExportedPWD-$($username).txt"
$secureStringPwd = ConvertTo-SecureString -string (Get-Content $PwdTXTPath)
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList $username, $secureStringPwd

Connect-MicrosoftTeams -Credential $cred

[string]$LoginToUser =  "LogintoCheck@yourdomain.com"

Write-host " -------------------------------------------------------------------------------------------- " -ForegroundColor green
Write-Host " => Login to check for the Teams:", $LoginToUser  -ForegroundColor Green

$ListOfMyTeams = Get-Team  -user $LoginToUser

foreach($MyTeams in $ListOfMyTeams)
	Write-host " -------------------------------------------------------------------------------------------- " -ForegroundColor green
	Write-Host "    ===-> Teams Name:", $MyTeams.GroupId, "- Name:", $MyTeams.DisplayName, "- Description:", $MyTeams.Description  -ForegroundColor Yellow
    Write-Host "    ===-> Get-TeamFunSettings:" -ForegroundColor Yellow
    Get-TeamFunSettings -GroupId $MyTeams.GroupId

    Write-Host "    ===-> Get-TeamGuestSettings:" -ForegroundColor Yellow
    Get-TeamGuestSettings -GroupId $MyTeams.GroupId

    Write-Host "    ===-> Get-TeamMemberSettings:" -ForegroundColor Yellow
    Get-TeamMemberSettings -GroupId $MyTeams.GroupId

    Write-Host "    ===-> Get-TeamMessagingSettings:" -ForegroundColor Yellow
    Get-TeamMessagingSettings -GroupId $MyTeams.GroupId

    Write-Host "    ===-> Get-TeamUser:" -ForegroundColor Yellow
    Get-TeamUser -GroupId $MyTeams.GroupId  | Format-Table

    $MyListOfChannelList = Get-TeamChannel -GroupId $MyTeams.GroupId
    foreach($MyChannel in $MyListOfChannelList)
	    Write-host "      ------------------ " -ForegroundColor green
	    Write-Host "      ===-> Channel Name:", $MyChannel.Id, "- Name:", $MyChannel.DisplayName, "- Description:", $MyChannel.Description  -ForegroundColor Magenta
        #$MyChannel | Get-Member

	Write-host " -------------------------------------------------------------------------------------------- " -ForegroundColor green

Write-host " -------------------------------------------------------------------------------------------- " -ForegroundColor green

You can customize that script as much as you want.


If you need more management or action around Teams, you have to look the Office Graph Usage instead of that module.


Fabrice Romelard


Sources used to build it:

French version:

1 Reply

RE: Teams: PowerShell script to get the list of Teams associated with a dedicated user

If you want to discover les Graph API capabilities, a good starting point is here: - https://blog.thoughtstuff.co.uk/2017/07/how-to-manage-microsoft-teams-send-messages-using-the-teams-... Fab
Related Conversations
Announcing a Microsoft Teams AMA!
Dylan Snodgrass in Microsoft Teams AMA on
9 Replies
Add a member to a channel within a team
Denis Soldatenko in Microsoft Teams on
6 Replies
Adding external users to teams
Catherine CHAZELAS in Microsoft Teams on
46 Replies
What proxy setting is Teams using?
Claude Villermain in Microsoft Teams on
13 Replies
Problems loging into Teams!
adam deltinger in Microsoft Teams on
9 Replies