All About the Latest Version of the Microsoft Teams PowerShell Module

Current Version of the Microsoft Teams PowerShell Module is 5.2

Updated April 1, 2022

On March 31, 2022, Microsoft announced that they will cease support for versions older than 4.0 in mid-June (MC350371), so you should now be using version 4.0 or later. See this page for information about the supported versions.

Microsoft Teams PowerShell module in the PowerShell Gallery
Figure 1: Microsoft Teams PowerShell module in the PowerShell Gallery

Updating the Module

Updating the Microsoft Teams module is easy. In an administrator PowerShell session, run the Update-Module cmdlet. Here’s an example showing how to update the Microsoft Teams module to a specific version:

Update-Module MicrosoftTeams -RequiredVersion 5.2 -Force

A lot of the development work now being done in the Teams PowerShell module is the modernization of the cmdlets inherited from the Skype for Business Online connector. These cmdlets (like Get-CsTeamsMeetingPolicy) are used for policy management and, unlike the Teams management cmdlets, are not based on the Microsoft Graph. The work includes the removal of basic authentication (now done for more than 50% of the cmdlets), including removal of dependencies on components like WinRM. Note that the use of basic authentication does not mean that user credentials are transmitted in clear text (OAuth tokens are sent, but not user credentials).

I’ve published a script to help update a bunch of PowerShell modules related to Microsoft 365, including Teams, at one time. It helps keep everything shipshape, including removing old versions of the modules from the workstation. If you use these modules with Azure Automation, make sure that you update the modules linked as resources in automation accounts too.

Version 5.2

Microsoft shipped Version 5.2 on May 15, 2023. This version includes:

  • Modernized versions of several cmdlet sets, including CsTeamsAppPermissionPolicy, CsTeamsAppSetupPolicy, CsTeamsEventsPolicy, CsExternalAccessPolicy, and CsTeamsCallingPolicy. The functionality of these cmdlets remains the same.
  • Changes to the Teams Shifts cmdlets.
  • Adds the HideAuthorizedUsers parameter to CsAutoAttendant and CsCallQueue New/Set cmdlets.
  • Release of the Set|Clear-TeamsEnvironmentConfig and Get|Set-CsTeamsSettingsCustomApp cmdlets.
  • Fixes for the ComplianceRecordingPolicy and ComplianceRecordingApplication cmdlets.

Version 5.1

Microsoft shipped Version 5.1 on March 31, 2023. The changes that took my eye are:

  • The modernized versions of the Get-CsOnlineUser and Get-CsOnlineVoiceUser cmdlets are now available in GCC High and DoD tenants. TeamsEventsPolicy (needed for webinars) is now included un Get-CsOnlineUser output.
  • The meeting policy cmdlets (like Get-CsTeamsMeetingPolicy) support a bunch of watermarking controls needed for the premium feature.
  • The messaging policy cmdlets (like Get-CsTeamsMessagingPolicy) support the EnableInOrganizationChatControl and InOrganizationChatControl controls. I don’t have details about what these settings do yet.
  • The branding policy cmdlets (like Get-CsTeamsMeetingBrandingPolicy) get a new RequireBackgroundEffect parameter (premium feature).

Version 5.0

This version appeared in early March 2023 and focuses on a major update for the Get-CsOnlineUser cmdlet. See this post for more information.

Version 4.9.3

Issued without notice on January 31, 2023, the changes in this version include:

  • Addition of the Certificate parameter for Connect-MicrosoftTeams (fixes some known issues with certificate-based authentication).
  • Adds WelcomeTextToSpeechPrompt parameter to [New|Set]-CsCallQueue.
  • Fixes issues with pipeline input for Test-CsEffectiveTenantDialPlan & Test-CsVoiceNormalizationRule cmdlets.
  • Releases [Get|Set]-CsOnlineVoicemailValidationConfiguration cmdlets.
  • Releases [Get|Set|Grant|Remove|New]-CsTeamsMeetingBrandingPolicy cmdlets (for Teams Premium). A known issue exists that prevents using the ‘Remove’ list modifier when trying to delete a TeamsMeetingBrandingTheme or a NdiAssuranceSlate. To remove all elements from MeetingBrandingThemes, the workaround is to set the values to null. For example:
Set-CsTeamsMeetingBrandingPolicy -Identity <Identity> -MeetingBrandingThemes $null -DefaultTheme ""
  • To update Meeting branding themes, use the Set-CsTeamsMeetingBrandingPolicy cmdlet and pass the list of desired branding themes created with New-CsTeamsMeetingBrandingTheme (this somewhat clumsy implementation will be fixed in the next release). Example:
$exampleMeetingBrandingTheme = New-CsTeamsMeetingBrandingTheme -DisplayName "exampleTheme" -LogoImageLightUri "" -LogoImageDarkUri "" -BackgroundImageLightUri "" -BackgroundImageDarkUri "" -BrandAccentColor "#000000" -Enabled $true -Identity "exampleTheme"
Set-CsTeamsMeetingBrandingPolicy -Identity <Identity> -MeetingBrandingThemes @($exampleMeetingBrandingTheme) -DefaultTheme "exampleTheme"
  • Releases [New]-CsTeamsMeetingBackgroundImage cmdlet.
  • Releases [New]-CsTeamsMeetingBrandingTheme cmdlet.
  • Releases [New]-CsTeamsNdiAssuranceSlate cmdlet.
  • Delivers a new implementation of [New|Get|Set|Remove]-CsTeamsCallHoldPolicy, [New|Get|Set|Remove]-CsTeamsEmergencyCallingPolicy, [New]-CsTeamsEmergencyCallingExtendedNotification. The functionality remains the same as in the previous implementation.

Version 4.9.1

An unusual interim update released on November 15, 2022, V4.9.1 of the Microsoft Teams PowerShell module contains the generally available implementation of application-based authentication support for the Connect-MicrosoftTeams cmdlet. Several other changes are in the module, including:

  • A new implementation of the *-CsTeamsChannelPolicy and *-CsTeamsUpdateManagementPolicy cmdlet sets. The Set- and New-CsTeamsUpdateManagementPolicy cmdlets also gain the UseNewTeamsClient parameter to prepare the way for the preview of the new Teams (V2) enterprise client. The Set- and New-CsTeamsChannelPolicy cmdlets have a new EnablePrivateTeamDiscovery parameter to allow clients to find teams marked as private.
  • Fixes problems with authentication token refresh in some cmdlets.
  • Adds several properties to Get-CsOnlineUser when run without an identity (for example, CountryAbbreviation).
  • Fixes problems with how some cmdlets display properties.
  • Fixes the Add-TeamChannelUser and Remove-TeamChannelUser cmdlets so that you can add or remove a user to a shared channel with a UPN rather than an object identifier.

Version 4.9

Released on November 1, 2022, V4.9 of the Microsoft Teams PowerShell module continues the work to modernize the cmdlets from the old Skype from Business Online connector. This work is important because some of the older cmdlets can’t run in environments like Azure Automation. The upgraded policy management cmdlets still aren’t perfect in terms of their support for Azure Automation, but they do work (as illustrated by this example).

The notable changes in V4.9 include:

  • Modernized versions of the *-CsTeamsFeedbackPolicy, *-CsTeamsMessagingPolicy, *-CsTeamsMeetingPolicy, and *-CsOnlineVoiceMailPolicy cmdlet sets.
  • The Get/Set-CsTeamsEducationConfiguration cmdlets are now GA. This only affects Teams for Education deployments.
  • Adds the ExplicitRecordingConsent and ForceStreamingAttendeeMode parameters to the Teams meeting policy cmdlets.
  • Adds the Description, PreambleAudioFile, and PostambleAudioFile to the Online voicemail policy.
  • Adds the AllowChatWithGroup parameter to the Teams messaging policy.
  • Adds the EnableFeedbackSuggestions parameter to the Teams feedback policy.
  • Releases the Update-CsTeamsShiftsConnectionInstance cmdlet.

For the record, the Add-TeamChannelUser issue remains unresolved in V4.9. Documentation has not been updated at the time of writing.

Version 4.8

Released on October 11, 2022, V4.8 of the Microsoft Teams PowerShell module is another incremental fit and finish update. Microsoft documents the following in its release notes:

  • [Get|New]-CsTeamsShiftsConnectionTeamMap cmdlets – TimeZone attribute added.
  • Removes SendEmailFromAddress and SendEmailFromDisplayName input parameters from Set-CsOnlineDialinConferencingUser.Removes AllowAllAcsResources and BlockedAcsResources parameters from Set-TeamsAcsFederationConfiguration.
  • Adds ForceListenMenuEnabled parameter to callflow settings in New-CsAutoAttendantCallFlow, New-CsAutoAttendant and Set-CsAutoAutoAttendant. This setting enables the tenant to ignore DTMF/speech inputs while greetings/menu options are played.

I thought that Microsoft was going to fix the bug in the Add-TeamChannelUser cmdlet that prevents a user from another tenant being added to a shared channel when specifying their user principal name – but they haven’t!

Version 4.7

Microsoft released V4.7 of the MicrosoftTeams PowerShell module on September 1, 2022. Unlike V4.6, this is very much a fit-and-finish release and most tenant administrator will not notice the changes because of the lack of impact on mainline cmdlets. Here’s the set of changes as documented in the release notes.

  • Fixes issues with process clean-up when using module on PS ISE and dotnet applications.
  • General availability of the [Get|New]-CsBatchTeamsDeployment cmdlets.
  • Releases [New|Set]-CSTeamsShiftsConnectionInstance, Test-CsTeamsShiftsConnectionValidate support for UKG Dimensions.
  • Fixes issues with incorrect token fetch while choosing between multiple accounts using AccountId parameter in Connect-MicrosoftTeams.
  • Default values of Conference mode & Presence mode attributes are changed from false to true for New-CsCallQueue cmdlet.

Version 4.6

Microsoft released V4.6 of the MicrosoftTeams PowerShell module on July 29, 2022. Continuing the recent trend, the new version contains a lot of modernization activity as Microsoft seeks to upgrade cmdlets (mainly from the old Skype for Business connector) to match updated standards. Among the changes are:

The Get-CsOnlineUser cmdlet now has an AccountType parameter. For example, to find user accounts:

Get-CsOnlineUser -AccountType User | Format-Table DisplayName

This command returns accounts for user and shared mailboxes. The cmdlet supports “Guest” as a parameter value, but it doesn’t return any guest accounts in my tenant. Some other bits might be needed.

The *-CsTeamsEventsPolicy cmdlet set is added. This appears to be a policy to control webinars, perhaps to move settings for these (and other events) out of the meeting policy.


AllowWebinars   : Enabled
EventAccessType : Everyone
Description     : Default policy
DataSource      :
Key             : ScopeClass=Global;SchemaId=;AuthorityId=;DefaultXml=;XmlRoot=
Identity        : Global

Some extra cmdlets to support shared channels are added. For example, the Add-TeamChannelUser cmdlet now takes an optional tenant identifier to allow the addition of a user from an external tenant to a shared channel:

Add-TeamChannelUser -GroupId b647d5ff-3bda-4333-b768-7990084569b6 -DisplayName "📔Teams Practices and Architecture" -User "" -TenantId 22e90715-3da6-4a78-9ec6-b3282389492b

The Get-SharedWithTeam cmdlet checks if a shared channel is shared with a team:

Get-SharedWithTeam -HostTeamId b647d5ff-3bda-4333-b768-7990084569b6 -ChannelId "19:5-aYUE7mEEoAmK8gzNZDfT6aTmsyh5DXKAWLNP45aks1@thread.tacv2" | fl

GroupId     : b647d5ff-3bda-4333-b768-7990084569b6
DisplayName : Office 365 Adoption
TenantId    : a662313f-14fc-43a2-9a7a-d2e27f4f3478
IsHostTeam  : True

The Get-TeamAllChannel cmdlet returns all channels and their properties found in a team. This cmdlet makes it easier to report channels.

Get-TeamAllChannel -GroupId b647d5ff-3bda-4333-b768-7990084569b6

Id             : 19:212515334493446089249a5a1f7070cb@thread.tacv2
DisplayName    : Microsoft 365 Roadmap items
Description    :
MembershipType : Standard
HostTeamId     : a647d5ff-3bda-4333-b768-7990084569b6
TenantId       : a662313f-14fc-43a2-9a7a-d2e27f4f3478

Id             : 19:2868c84ae7ff43d09197f74ef44b4825@thread.tacv2
DisplayName    : Blog Posts
Description    : Blogs from many places
MembershipType : Standard
HostTeamId     : b647d5ff-3bda-4333-b768-7990084569b6
TenantId       : a662313f-14fc-43a2-9a7a-d2e27f4f3478

Id             : 19:44ecfd5231b44f4baf7bf664c7048e8e@thread.tacv2
DisplayName    : Project Hydra
Description    : Discussions about the Hydra Project
MembershipType : Private
HostTeamId     : a647d5ff-3bda-4333-b768-7990084569b6
TenantId       : a662313f-14fc-43a2-9a7a-d2e27f4f3478

Id             : 19:5-aYUE7mEEoAmK8gzNZDfT6aTmsyh5DXKAWLNP45aks1@thread.tacv2
DisplayName    : 📔Teams Practices and Architecture
Description    : Discussions about the most productive practices and architectural decisions in Microsoft Teams
MembershipType : Shared
HostTeamId     : b647d5ff-3bda-4333-b768-7990084569b6
TenantId       : a662313f-14fc-43a2-9a7a-d2e27f4f3478

The Get-TeamIncomingChannel cmdlet reports if a team has access to shared channels hosted in other tenants:

Get-TeamIncomingChannel -GroupId 5b617155-a124-4e32-a230-022dfe0b80ac

Id             : 19:qxTeKg0KEuJTNd9S-d75-dq4gJz30bdhSg4HOKBRj3Y1@thread.tacv2
DisplayName    : 📔Teams and Groups Discussion
Description    :
MembershipType : Shared
HostTeamId     : 2713f078-45a7-4b86-a548-d97870ad2b70
TenantId       : 22e90715-3da6-4a78-9ec6-b3282389492b

The Get-AssociatedTeam cmdlet reports the set of teams a user has access to, including teams hosting shared channels in another tenant (like the last team in the example listing):

Get-AssociatedTeam -User

GroupId                              DisplayName         TenantId
-------                              -----------         --------
82ae842d-61a6-4776-b60d-e131e2d5749c Rugby Lovers        a662313f-14fc-43a2-9a7a-d2e27f4f3478
bda4f6ed-f102-4a23-a2f7-ef363f45ded6 Sales Team          a662313f-14fc-43a2-9a7a-d2e27f4f3478
fee4a526-fd91-46e9-a45b-cdb92f929602 Corona Virus News   a662313f-14fc-43a2-9a7a-d2e27f4f3478
9367a82e-9c65-4258-86fb-c2eb304c79ef Privacy Advocates   a662313f-14fc-43a2-9a7a-d2e27f4f3478
50a43aed-4a24-4925-a2f4-6545e63a066d James Hoover Team   22e90715-3da6-4a78-9ec6-b3282389492b

The Get-TeamTargetingHierarchyStatus cmdlet is also released, but I don’t see how this is used.

Version 4.5

On July 1, 2022, Microsoft published V4.5.0. This release doesn’t contain anything earthshattering and is largely devoted to a set of fixes and enhancements (see the release notes). The Get-CsOnlineUser cmdlet now supports a SoftDeletedUsers parameter to list soft-deleted Azure AD accounts enabled for Teams:

Get-CsOnlineUser -SoftDeletedUsers | ft Displayname, SoftDeletionTimestamp

DisplayName   SoftDeletionTimestamp
-----------   ---------------------
Maurice Keane 01/07/2022 10:17:13

The Teams module doesn’t contain a cmdlet to restore a soft-deleted account. To do that, you’ll need to use a cmdlet like Restore-MgDirectoryDeletedItem as described in this article.

Version 4.4.1

On June 1, 2022, Microsoft published V4.4.1. This follows the release of 4.3 in May (not much happened in that version). Work continues to modernize the old Skype for Business policy management cmdlets and to fix bugs. The most important changes in this release are:

  • The Get-CsOnlineUser cmdlet now returns null values if a user doesn’t have an explicit policy assigned (in other words, they use the default tenant policy).
  • The Get-CsPhoneNumberAssignment cmdlet returns new City and IsoSubDivision attributes.

In reality, not much to report…

Version 4.2

On April 13, 2022, Microsoft published V4.2 of the Microsoft Teams PowerShell module in the PowerShell Gallery. The release notes for the module are sadly deficient in terms of the clarity and completeness of the information they offer about the changes. I’ve noted these concerns to the Teams developers because it doesn’t take much effort for a program manager to write up some concise and coherent notes instead of grabbing a bunch of developer comments about changes. Here’s my interpretation of the changes:

Proxy support for all the cmdlets relevant for Teams. The supported cmdlets are being gradually rolled out.

In other words, Microsoft has deprecated some old cmdlets only used for managing Skype for Business Online. These cmdlets will be removed from the MicrosoftTeams module over the next few months.

Fixes issues with [New|Set]- modernized Policy cmdlets when used with PSListModifier type parameters.

This is an internal fix which shouldn’t affect scripts.

[BREAKING CHANGE] PSListModifier type parameters will only accept Hashtable with Add or Remove. Hashtable with Replace is not supported now, instead value(s) can be set directly in the parameter.

PSListModifier is a helper class used by many cmdlets to manipulate lists (for instance, the set of email addresses assigned to a mail-enabled recipient). Instead of passing simple values in parameters to update lists, you need to use hash tables.

Fixes format issues with [Get|New]- of few modernized Policy cmdlets (CsVideoInteropServiceProvider, CsInboundBlockedNumberPattern, CsTeamsComplianceRecordingApplication, CsTeamsTranslationRule, CsTeamsUnassignedNumberTreatment, CsVoiceNormalizationRule).

Improved performance of pipeline input processing with the modernized cmdlets.

A modernized cmdlet is one that is REST-based (AutoRest-generated) instead of communicating with the server using the older PowerShell remoting method. Some of the cmdlets needed a little help to improve their performance.

Fixes minor issues with pipeline input results.

Apparently, the fix makes sure that Catch handles errors correctly.

Get-CsOnlineUser: Country attribute (known as CountryOrRegionDisplayName in versions earlier than 3.x.x), is added.

[BREAKING CHANGE] Get-CsOnlineUser: CountryAbbreviation attribute is now only available when used with -Identity parameter.

Both these changes are due to an update to an internal store. You should update scripts to use Country instead of CountryOrRegionDisplayName and make sure that the identity parameter is passed to Get-CsOnlineUser when you want to see the CountryAbbreviation attribute. For example:

(Get-CsOnlineUser -Identity

[BREAKING CHANGE] Get-CsOnlineVoicemailPolicy returns data for MaximumRecordingLength in string format instead of TimeSpan.

The change from date time to string output might break some scripts.

Updates in Version 4.0

Version 4.0 of the Microsoft Teams PowerShell module is mostly a fit and finish release. This update marks the completion of the work to modernize the old policy management and voice cmdlets inherited from Skype for Business Online to versions that don’t use remoting. The new versions of the cmdlets should be more stable than their predecessors. Other changes include:

  • Release of the *-CsCallingDelegate and *-CsUserCallingSettings cmdlets.
  • The InMemory switch is no longer supported for any cmdlet except New-CsVoiceNormalizationRule.
  • The following cmdlets are deprecated: ConvertTo-JsonForPSWS, Set-CsUserServicesPolicy, [Get|Set]-CsNetworkConfiguration, [Set|Remove]-CsTenantNetworkConfiguration, New-CsNetworkMediaBypassConfiguration, [Get|Grant|New|Remove|Set]-CsTeamsVerticalPackagePolicy,[Get|Remove|Set]-CsVoiceNormalizationRule.

It doesn’t appear that Microsoft has done any work to the cmdlets used to create and manage teams. Updates for shared channels were available in version 3.1.1. However, some shared channel operations are still not possible in PowerShell, such as inviting a team to join a channel.

Updates in Versions 3.0-3.1.1

Most of the work on the Microsoft Teams PowerShell module since 2.6.0 has focused on the older policy cmdlets inherited from the Skype for Business like Grant-CsApplicationAccessPolicy. The work converts the cmdlets from using remoting (based on the WS-Management protocol) to a more modern implementation better suited for cloud environments. Some performance issues have also been addressed. So far, there are no reports of any problems with the 3.1.1 version.

Updates in 2.6.0

So far, no known errors have shown up in version 2.6 of the Microsoft Teams PowerShell module. 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 release of the Microsoft Teams PowerShell 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 the V2.3.1 of the Microsoft Teams PowerShell module are mostly bug 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.

77 Replies to “All About the Latest Version of the Microsoft 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.

  16. Version 4.0 has not helped me. I have since gone back to 2.6.0

    Here is the short list of issues I’ve had

    Issue 1: grant-cs*policy is broken if you use UPN. It does seem to work in pipeline get-csonlineuser -identity | grant-cs*policy -policyname OR if you grant-cs*policy -identity ObjectID

    Issue 2: try/catch exceptions fail for get-csonlineuser if user doesn’t exist.. breaks all my existing scripts

    Issue 3: Property Name changes – having to update all existing scripts

    Issue 4: Deprecated a bunch of properties – including removing lastname?

    1. Have you logged these problems with Microsoft Support? I can ping them on it, but any complaint gets traction when it’s backed up by a customer support incident.

      1. Yes, Issue was confirmed by folks within the product group and others. I’m on my first week with support for issue 2. Issue 3 is by design, and issue 4 I will open another ticket once I can get through to the correct engineering group with Issue 2.

    2. Several cmdlets now don’t work with try/catch for specific error message types – I suspect this has to do with moving a lot of cmdlets to the newer graph APIs.

      What I’ve had to do in the try block is grab a result using a variable – like $result = (get-csonlineuser -idenity ) then you can do a catch block for normal errors and then do a an if ($result) for non-normal errors that are not caught with try/catch
      Soemthing like below – or whatever you want to do with the $result – just remember to reset $result to $null if every time if in a loop.
      Try { $result = (get-csonlineuser -identity }
      Catch {write-host $result} #to catch normal errors
      If ($result) {write-host $result} #to catch non-normal errors where you get “Bad Request” or something like that

      1. Yes this is exactly what I’m doing but I still get the error no exception. Are you not able to reproduce?

      2. This is what I heard back from Microsoft:

        1 – The Policy team is fixing this and will be sorted tentatively by next week.
        2 – Is also getting fixed and will soon be available in the next Teams PowerShell Module release.
        3,4 – Yes, there are few changes largely with Get-CsOnlineUser & Get-CsOnlineVoiceUser from version 3.0.0 onwards. The team has updated the respective public documentation pages with details. Also there was a Message Center post recently with details as well (MC340774).

        I pointed out that developers don’t usually read message center posts…

    1. @brad, can you provide an example of the issues you’re having with try/catch? The developers would like to use to test against a fix they have… Post some code here and I will pass it on.

      1. In 2.6.0 the exception message is:

        Management object not found for identity “”.

        in 4.0.0 the exception never gets captured and get an immediate: Microsoft.Teams.ConfigAPI.Cmdlets.internal\Get-CsUser : userId was not found….

        Here’s a simple try/catch script I’ve been testing with:

        #Script Start

        try {

        $data = Get-CsOnlineUser -Identity -ErrorAction Stop | select displayname,accountenabled

        if ($data){
        Write-Host “User successfully found” -ForegroundColor Blue

        else {
        catch {

        $RealErrorCaught = $error.exception.message

        if ($RealErrorCaught){
        Write-Host “Friendly Error Message: User does not exist” -ForegroundColor Yellow
        Write-Host “”
        Write-Host “Actual Error from Command: $($RealErrorCaught)” -ForegroundColor Green
        else {
        write-host “$($data.displayname) is currently enabled: $($data.accountenabled)”
        #Script End

      2. Ta. BTW, Microsoft says that they have released V4.0.1-PPreview which contains some fixes around ErrorAction. And they say that the 4.0.1 preview should work with your code.

  17. Thanks for the update, the 4.0.1-preview does indeed help with the exception. I’m getting the following now:

    [NotFound] : userId was not found

  18. using 4.2.0 (and some previous versions)

    Set-CsCallQueue with empty set of Users or DistributionLists fails. So, it is not possible to remove all users or distributionlists

    Set-CsCallQueue -Identity 182eafbd-5685-4118-8014-38c296e1060c -Users @()
    Set-CsCallQueue -Identity 182eafbd-5685-4118-8014-38c296e1060c -DistributionLists @()

    Set-CsCallQueueModern : Exception calling “Add” with “2” argument(s): “Et element med samme nøgle er allerede tilføjet.”
    At C:\Program Files\WindowsPowerShell\Modules\Microsoftteams\4.2.0\net472\exports\ProxyCmdletDefinitions.ps1:47374 char:9
    + $steppablePipeline.Process($_)
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [Set-CsCallQueueModern], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentException,Set-CsCallQueueModern

  19. I believe the example for v4.6 regarding Add-TeamChannelUser for shared channels is incorrect. It works with the users objectId from the external tenant, but not with the UPN for some reason.

  20. I’m using 4.7, and with the UPN it throws the following error:
    Add-TeamChannelUser: Error occurred while executing Add-TeamChannelUser
    Code: Forbidden
    Message: User is not allowed to be added due to xTap.

    With the same user and the objectId everything works as expected.

    Have you tried this successfully yourself?

    1. I have done this successfully in the past. Now I am getting errors even when using the object id for a user. The Teams client can add the user, so it’s not an access policy problem. Time to talk to Microsoft…

    1. Microsoft is working on an update to allow the UPN to be used. They’re just limited to objectId for now, but it doesn’t take much to translate a UPN to an objectId.

  21. 4.9.1 resolves this:
    “Fixes Add-TeamChannelUser & Remove-TeamChannelUser to take UPN for -User parameter to manage external members in a shared channel.”

  22. We are having trouble with creating new application instances using new-csonlineapplicationinstance. The application instance is created, but we are not able to read is back using get-csonlineapplicationinstance or get-csonlineuser (error: NotFound). We have tried calling sync-csonlineapplicationinstance, but this doesn’t helper either.

    Anyone having the same issue?

Leave a Reply

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