Forum Discussion
RobinMalik
Jul 19, 2021Copper Contributor
PowerShell: Get-Team unreliable / returning incomplete results
Hi, We have multiple issues with the Get-Team cmdlet in the MicrosoftTeams module (v2.3.0). Like many organisations, we're programmatically creating Teams based on organisational data (e.g. one T...
CarlosAndreu
Feb 16, 2022Copper Contributor
It is truly disconcerting behavior.
I can understand that by default it does an approximate search ("-contains") but a "-exactmatch" parameter would be appreciated so that it returns exactly what I am looking for.
My problem is that I want to retrieve a Team by its "DisplayName" but it returns several Teams.
In the end I workedaround it by filtering the result again by the DisplayName; that is:
$Course = Get-Team -Archived $false -DisplayName $Student.course | Where-Object {$_.DisplayName -eq $Student.course}