SOLVED

Teams PowerShell module issue: cmdlet Get-Teams not working properly

%3CLINGO-SUB%20id%3D%22lingo-sub-1576967%22%20slang%3D%22en-US%22%3ETeams%20PowerShell%20module%20issue%3A%20cmdlet%20Get-Teams%20not%20working%20properly%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1576967%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20all%2C%3CBR%20%2F%3EI%20have%20recently%20been%20tasked%20with%20doing%20some%20reporting%20on%20Teams%20usage%20for%20our%20organisation.%20Being%20familiar%20with%20PowerShell%20this%20seemed%20like%20the%20logical%20choice%20to%20me%20for%20retrieving%20the%20data%2C%20however%20I%20have%20been%20getting%20some%20very%20strange%20results%20when%20using%20v1.1.4%20of%20the%20%22MicrosoftTeams%22%20module%20downloaded%20from%20the%20PowerShell%20gallery.%3CBR%20%2F%3E%3CBR%20%2F%3EOur%20company%20has%20hundreds%20of%20Teams%2C%20yet%20when%20I%20run%20the%20cmdlet%20%22Get-Team%22%20it%20takes%20an%20hour%20or%20so%20to%20retrieve%20just%204%20results.%20Unfortunately%20I%20am%20not%20an%20administrator%20for%20Office365%20however%20I%20would%20think%20if%20this%20was%20the%20root%20of%20the%20issue%20it%20would%20either%20return%20nothing%20or%20everything%2C%20not%20just%20a%20few%20Teams!%20Another%20thing%20I%20considered%20was%20perhaps%20the%20results%20returned%20were%20only%20for%20Teams%20that%20I%20am%20a%20%22Owner%22%20of%2C%20however%20when%20using%20the%20cmdlet%20with%20the%20-DisplayName%20flag%20to%20specify%20other%20Teams%20I%20could%20return%20any%20other%20team%20I%20wanted%20to.%20This%20is%20obviously%20not%20the%20ideal%20way%20to%20retrieve%20all%20the%20data%20we%20need%20and%20my%20understanding%20was%20that%20the%20Get-Team%20cmdlet%20should%20return%20all%20results%20for%20the%20company.%20This%20combined%20with%20the%20fact%20that%20it%20takes%20over%20an%20hour%20to%20produce%20the%20same%204%20results%20each%20time%20has%20me%20wondering%20what%20could%20possibly%20be%20happening%20in%20the%20background%3B%20it%20seems%20that%20something%20is%20not%20configured%20correctly%20or%20there%20is%20a%20bug%20within%20the%20Get-Team%20cmdlet%20since%20it%20should%20not%20take%20that%20long%20to%20return%20results%20from%20Azure!%3CBR%20%2F%3E%3CBR%20%2F%3EHas%20anyone%20else%20had%20similar%20issues%3F%20What%20might%20I%20do%20to%20better%20diagnose%20%2F%20resolve%20the%20problem%3F%3CBR%20%2F%3EThanks%20in%20advance!%3CBR%20%2F%3E%3CBR%20%2F%3EEd%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1576967%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1578721%22%20slang%3D%22en-US%22%3ERe%3A%20Teams%20PowerShell%20module%20issue%3A%20cmdlet%20Get-Teams%20not%20working%20properly%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1578721%22%20slang%3D%22en-US%22%3E%3CP%3ESeems%20to%20be%20working%20fine%20here%2C%20but%20it%20certainly%20wont%20be%20the%20first%20time%20the%20module%20has%20had%20issues.%20I'd%20suggest%20using%20the%20unified%20group%20cmdlets%20wherever%20possible%20instead%2C%20or%20even%20doing%20direct%20Graph%20API%20calls%20via%20PowerShell.%20As%20for%20the%20issue%20at%20hand%2C%20you%20can%20open%20a%20support%20case%20and%20report%20it.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1581096%22%20slang%3D%22en-US%22%3ERe%3A%20Teams%20PowerShell%20module%20issue%3A%20cmdlet%20Get-Teams%20not%20working%20properly%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1581096%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F58%22%20target%3D%22_blank%22%3E%40Vasil%20Michev%3C%2FA%3E%26nbsp%3BThanks%20for%20this%20information%2C%20much%20appreciated!%20I%20did%20some%20digging%20but%20unfortunately%20couldn't%20find%20out%20which%20PS%20module%20contained%20the%20unified%20group%20cmdlets...%20However%20I%20had%20more%20luck%20when%20investigating%20Microsoft%20Graph%20and%20this%20looks%20like%20really%20good%20solution%3B%20it%20has%20a%20very%20comprehensive%20API%20and%20was%20fast%20to%20connect.%20I%20setup%20an%20App%20Registration%20and%20got%20it%20to%20authenticate%20correctly%2C%20now%20all%20I%20need%20to%20do%20is%20request%20Admin%20approval%20for%20reading%20the%20data%20with%20my%20script!%3CBR%20%2F%3ECheers%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EEd%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

Hi all,
I have recently been tasked with doing some reporting on Teams usage for our organisation. Being familiar with PowerShell this seemed like the logical choice to me for retrieving the data, however I have been getting some very strange results when using v1.1.4 of the "MicrosoftTeams" module downloaded from the PowerShell gallery.

Our company has hundreds of Teams, yet when I run the cmdlet "Get-Team" it takes an hour or so to retrieve just 4 results. Unfortunately I am not an administrator for Office365 however I would think if this was the root of the issue it would either return nothing or everything, not just a few Teams! Another thing I considered was perhaps the results returned were only for Teams that I am a "Owner" of, however when using the cmdlet with the -DisplayName flag to specify other Teams I could return any other team I wanted to. This is obviously not the ideal way to retrieve all the data we need and my understanding was that the Get-Team cmdlet should return all results for the company. This combined with the fact that it takes over an hour to produce the same 4 results each time has me wondering what could possibly be happening in the background; it seems that something is not configured correctly or there is a bug within the Get-Team cmdlet since it should not take that long to return results from Azure!

Has anyone else had similar issues? What might I do to better diagnose / resolve the problem?
Thanks in advance!

Ed

2 Replies
Highlighted
Best Response confirmed by ThereseSolimeno (Microsoft)
Solution

Seems to be working fine here, but it certainly wont be the first time the module has had issues. I'd suggest using the unified group cmdlets wherever possible instead, or even doing direct Graph API calls via PowerShell. As for the issue at hand, you can open a support case and report it.

Highlighted

@Vasil Michev Thanks for this information, much appreciated! I did some digging but unfortunately couldn't find out which PS module contained the unified group cmdlets... However I had more luck when investigating Microsoft Graph and this looks like really good solution; it has a very comprehensive API and was fast to connect. I setup an App Registration and got it to authenticate correctly, now all I need to do is request Admin approval for reading the data with my script!
Cheers,

 

Ed