All About the Latest Version of the Teams PowerShell Module

Current Version is 2.6.0

Updated 1 October 2021

On September 30 2021, Microsoft published V2.6.0 of the Microsoft Teams PowerShell module in the PowerShell Gallery. The release notes for the module give some information about the changes (see below).

Teams PowerShell module 2.6
Figure 1: Head to the PowerShell Gallery to get Version 2.6.0 of the Microsoft Teams module

Updating the module is easy. In an administrator PowerShell session, run the command:

Update-Module MicrosoftTeams -RequiredVersion 2.6.0 -Force

Updates in 2.6.0

So far, no known errors have shown up in version 2.6. The changes noted in the release notes are:

  • Fixes the bug where MicrosoftTeams module lookup failed if made a nested module of another custom PowerShell module. Now, MicrosoftTeams cmdlets are available even if it’s a nested module of another module.
  • Releases [Get|New|Complete|Clear]-CsOnlineTelephoneNumberOrder cmdlets.
  • Releases Get-CsOnlineTelephoneNumberCountry and Get-CsOnlineTelephoneNumberType cmdlets.
  • Releases new parameters for these cmdlets : Get-CsOnlineApplicationInstance, New-CsExternalAccessPolicy, New-CsTeamsAppSetupPolicy, New-CsTeamsCallingPolicy, New-CsTeamsCallParkPolicy, New-CsTeamsMeetingPolicy, New-CsTeamsMessagingPolicy, Set-CsTeamsAppSetupPolicy, Set-CsTeamsCallParkPolicy, Set-CsTeamsGuestMessagingConfiguration, Set-CsTeamsMeetingPolicy, Set-CsTenantFederationConfiguration, Set-CsExternalAccessPolicy, Set-CsTeamsCallingPolicy.
  • Fixes the failure that occurred when retrying login with Connect-MicrosoftTeams after an incorrect sign-in attempt.
  • Fixes Add-TeamChannelUser and Remove-TeamChannelUser failing for private channel.
  • Updates to make the module’s release notes available in PowerShell Gallery for each new version.

I will update this list as more information becomes available.

Updates and Issues in 2.5.0

Here are some details of the changes in the 2.5.0 module:

  • Updates for AccessToken login with Connect-MicrosoftTeams. The Access Token login for the Connect-MicrosoftTeams cmdlet now uses a unified token array instead of separate parameters for each resource access token. Some fixes are also included for interactive logins using Connect-MicrosoftTeams in CloudShell.
  • Improvements to New-Team cmdlet for team creation scenarios. The improvements are bug fixes to address issues reported when running New-Team to create new teams. However, the improvements appear to have introduced a new set of issues (see below).
  • TeamsUnassignedNumberTreatment cmdlets are now available. No further details are available.
  • The Get-CsCsOnlineDialInConferencingBridge and Set-CsOnlineDialInConferencingBridge cmdlets are available (if you have Teams Voice licenses).
  • “Modernized” (Graph-based) versions of the Get-CsTenant and Get-CSOnlineUser cmdlets (using the identity parameter only) are available. The Get-CSOnlineUser cmdlet, which returns details of a Teams user and the policies assigned to their account, is often used in scripts. Modernization should ensure that output is the same as the old version of the cmdlet but experience tells that this is sometimes not the case, so it is wise to test scripts which use the cmdlet to validate that everything works as expected. For instance, the LineURI property no longer has a “Tel:+” prefix.

One problem reported in 2.5 is that the New-Team cmdlet does not return the GUID (object identifier) of the newly created team. A new team is created successfully but New-Team returns Graph target resource information which must be parsed to extract the GUID. For example, before 2.5, the $TeamId variable would contain a valid GUID. You can see what it now gets from New-Team:

$TeamId = New-Team -DisplayName "Auxerre Lovers" -Description "Auxerre people" -MailNickName Auxerre.Team -Owner -Visibility Public

C:\> $TeamId


You can extract the GUID from the information returned by New-Team and use it. For example:

$GroupId = $TeamId.TargetResourceLocation.SubString($TeamId.TargetResourceLocation.IndexOf("'")+1,36)

Get-Team -GroupId $GroupId

GroupId                              DisplayName        Visibility  Archived  MailNickName       Description
-------                              -----------        ----------  --------  ------------       -----------
75c2bd1a-d67d-417c-99c8-faa14e8be918 Auxerre Lovers     Public      False     AuxerreLovers      Auxerre people

Obviously, going through the extraction is a royal pain. Microsoft withdrew and reissued 2.5 to include the old version of the cmdlet and then fixed the bug in version 2.6.

For some reason, although the documentation for the Connect-MicrosoftTeams cmdlet includes the option to use a certificate thumbprint to authenticate, the cmdlet in 2.5.0 is missing the CertificateThumbPrint parameter. I’ve asked Microsoft why.

Updates in 2.3.1

The changes in V2.3.1 are mostly fixes and don’t stretch to much new functionality. Here’s what’s important:

  • A new cmdlet (Get-MultiGeoRegion) is available to get the multi-geo region for teams and groups. This is part of the Teams support for multi-geo organizations announced at Ignite 2021.
  • The release notes for V2.2.0 preview said that another new cmdlet (Get-LicenseReportForChangeNotificationSubscription) would “get details of total change notification events that can be sent to users,” whatever that means. This cmdlet hasn’t made it into V2.3.1.
  • The V2.2.0 preview also discussed some internal engineering in the refactoring of remote session management. As Microsoft observed at the time, this change should result in no functional change for tenant admins. There’s no mention of this work for V2.3.1, but Microsoft does say that they have fixed “a large latency issue while remoting commands,” which could be connected.
  • General availability for the cmdlets to manage custom group policy assignments. Group policy assignments mean that organizations can build packages (sets) of policies to assign to groups (security groups, Microsoft 365 groups, or distribution lists). Microsoft includes some standard packages in Teams. If you want to build custom packages, you need the famous Teams Advanced Communications license.
  • Microsoft notes “updates to input parameters and output formats” for many cmdlets. This appears innocuous (and seem to affect policy cmdlets like Get-CsTeamsMeetingPolicy and Get-CsTeamsMessagingPolicy) but might affect scripts which depend on a certain parameter being passed or returned data being in a certain format. Changes like this underline the need for testing against a new module.

Because of the bug fixes included in module updates, we recommend you download and test your scripts against the latest version of the Teams PowerShell module as soon as convenient. If the tests prove successful, then you can deploy the new module into production.

Some Authentication Issues

Soon after the release of the 2.0 module, people realized that it didn’t work so well with integrated Windows authentication. This arose because of replacing the Active Directory Authentication Library (ADAL) with the Microsoft Authentication Library (MSAL). According to the release notes, V2.3.1 includes fixes for integrated Windows authentication to make the Connect-MicrosoftTeams cmdlet work better. However, some reports indicate that some problems still exist when running Connect-MicrosoftTeams. Organizations should test their scripts to establish if connection failures still exist and report the information to Microsoft.

Microsoft says that the errors in Set-CsUser and other cmdlets seen in earlier versions are now addressed.

Retirement of old Skype for Business Online Cmdlets

Microsoft upgraded the Teams module to 2.0 in March 2021. This was a big update because it marked the incorporation of the cmdlets from the old Skype for Business Online connector. Replacing the Skype for Business Online connector with the Teams PowerShell module means that tenants must upgrade their scripts to ensure that the correct module is loaded. Although the New-CsOnlineSession is no longer necessary to connect to what is now effectively the Teams policy endpoint, the other cmdlets previously accessed through the connector are available after Connect-MicrosoftTeams runs to create a new session. A big advantage is that there’s no need to run the Enable-CsOnlineSessionforReconnection cmdlet to stop the session timing out after an hour.

Stay acquainted with all the moving parts of Office 365 by subscribing to the Office 365 for IT Pros eBook. Monthly updates mean that we stay ahead of the game in terms of warning our readers when they need to take action.

51 Replies to “All About the Latest Version of the Teams PowerShell Module”

  1. Apparently the new 2.3.0 Teams PWS module, is utilizing CPU drastically for now obvious reason.
    Why MS has decreased performance on their “new” Teams module beats me, but the good “old” Skype for Business Online PWS module doesn’t.
    I really hope, that MS will look into this problem and solve this before discontinuing the SfB module.

  2. With the Set-CsUser I am getting access denied – What do you think I should do to work around this or resolve it?

    1. Report the problem to Microsoft. As I note in the article, there are some errors in Set-CsUser. The more support calls come in, the quicker this gets fixed.

  3. Just switched over to the MicrosoftTeams module, but now I am unable to set a phone number to an Teamsaccount. The Set-CsUser thorws an ‘Access dienied’ error, see example below:

    Set-CsUser -id -Phonenumber “tel:+31123456789”
    Set-CsUser : Access Denied.
    At line:1 char:1
    + Set-CsUser -id -Phonenumber “tel:+31123456789 …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: ({ Id = tst7045@…putParameters }:f__AnonymousType50`2) [Set-CsUser_SetExpanded], UndeclaredResponseExc
    + FullyQualifiedErrorId : Forbidden,Microsoft.Teams.ConfigAPI.Cmdlets.Generated.Cmdlets.SetCsUser_SetExpanded

    Any ideas, suggestions how to solve this?

    1. As I note in the article, there are known issues with the Set-CsUser cmdlet. Please report the issue to Microsoft so that the development group see that they need to fix the problem quickly.

  4. version 2.3.1 solves the problem about Set-CsUser:
    Set-CsUser -Id xxx@xx.xx -EnterpriseVoiceEnabled:$true -HostedVoiceMail:$true -OnPremLineURI “tel:+33xxxxxxxxx”
    does work now (tested with PS 5 and 6)

  5. However, the issues with Connect-MicrosoftTeams -AadAccessToken is still failing to access SFB cs-online commands. Please let us know if there are any known workarounds for this? Thank you.

    1. I believe there are some known issues still with AadAccessToken. The news on the grapevine is that a new preview version of the Teams module should help. No timeline when this will be available…

  6. -AadAccessToken with -MsAccessToken allows Get-Team to run however does not help with SFB cmdlets like Get-csTenant etc.
    Is there any other way to use Skype four business cmdlets without using user credentials ?

    1. I know that Microsoft is doing some more work to make it the cmdlets better. However, if you have a problem, make sure that you report the issue formally in a support incident. This is the only way to increase the pressure on the engineers to deliver what you need to work.

  7. We have been using both module 2.3.1 and 2.3.2 for a few days now and at first glance it looks fine with good performance and low CPU utilization.

    But after a few days, the first initial call to any CS function (i.e. Get-CsOnlineUser) takes more and more time to answer, and meanwhile the CPU is sky high. The time to complete the first call is as high as 200 seconds for small tenants (<50 users). When the first call is completed, the performance is great again.

    Has anyone else experienced this behavior?

    1. Sounds like more authentication woes. The engineers are working to improve the issues around authentication. I’ll flag this issue to them.

  8. Teams PS 2.x seems to have horrific performance. I have to run a regular Teams policy report against circa 80K users. It does a get-csonlineuser, then a foreach loop and for each user runs the get-csuserpolicyassignment command. On PS 1.x with the get-csonlinesession, the report took 7 hours (fine), on PS 2.x it’s not even a quarter way through after 2.5 days. Catch 22, can’t revert to 1.x because the new-csonlinesession command being blocked now.

      1. Thank you – I will log a call with them via my employer’s support arrangement. It’s causing me a headache, three weeks left on my contract and now my reporting is broke. I’ve seen a few people say that the newer versions of PS are slower with some commands, but with a tenancy that big, it’s going to be a major difference.

  9. Uninstall-Module -Name MicrosoftTeams -Force
    Install-Module -Name MicrosoftTeams -AllowClobber -Force
    Import-Module -name MicrosoftTeams
    Get-Module -Name microsoftTeams
    ModuleType Version Name ExportedCommands
    ———- ——- —- —————-
    Binary 2.3.1 MicrosoftTeams {Add-TeamUser, Connect-MicrosoftTeams, Disconnect-Microsof…

  10. CertificateThumbprint option in connect-microsoftteams is gone with version 2.5.0. Nothing about this in in release notes. Documentation does not state its gone.
    Why is this option gone when EXO, AAD scripts still support it?

  11. Anyone else having trouble with the Add-TeamChannelUser cmdlet in version 2.6.0? This version is supposed to fix this fail, but it’s still telling me it’s an unknown cmdlet (in a fresh install, no legacy versions)

    1. If you run Get-Command Add* -Module MicrosoftTeams, do you see Add-TeamChannelUser listed? I don’t… but I want to check that it’s not just something on my system.

  12. In 2.6.0, Connect-MicrosoftTeams -AccessTokens @($graphTokenResponse.access_token,$TeamsTokenResponse.access_token) -verbose still doesnt work.

  13. 2.6.0 Connect-MicrosoftTeams apparently has some broken services, as Get-CsCallQueue and Set-CSUser seems to be broken.
    How come MS doesn’t treat these services with more respect ie. ensuring continuity, as many organization rely on these services to be fully functional in order to perform user updates on a daily/hourly basis ?

  14. It appears with version 2.6.0 a lot of cmdlets have been changed from non-terminating class to terminating class. This is breaking all my scripts. Is there any reason for this change? Has anyone else notice this?

      1. When running scripts that use multiple cmdlets (set-csuser, grant-csonlinvoiceroutingpolicy, grant-cstenantdialplan, etc. sometimes you will see non-affecting CorrelationID errors that just means the back end is taking a lot time to process the command but when those errors are encountered the script would continue.

        I’ve found so far that if that CorrelationID error happens against the Grant-CsOnlineVoiceRoutingPolicy it terminates the script – thus the cmdlet seems to now be switched from non-terminating class to terminating class.

        Have had issues with Set-CsUser as well when failing due to some issue (typo in UPN for example) my old way of error handling would handle the error and the script would continue – now it instead terminates the entire script. I have had to rewrite portions of scripts to do error handling differently because of this.

  15. When I type connect-microsoftteams in powershell, it takes a while (about 5 minutes) to show the sign-in window and I’m using teams 2.6 module and powershell 5.1
    Does anyone has the same issue?

      1. Yes, all PCs; that’s odd because with older Teams modules never happened.

      2. I see a small delay when running Connect-MicrosoftTeams because it’s making a link to the Skype management endpoint (for policy management etc.). However, I’ve just done this on two tenants and in both cases the delay was ten or so seconds, not minutes.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.