What Broke after Teams Module Upgrade to version 4 ?

As you all are aware that Microsoft Teams module version prior to 4 no longer works correctly, it has been announced from long time that it will become unsupported.

Teams PowerShell Module – Supported Versions

Microsoft Teams PowerShell Module (TPM) versions in the 4.x.x series or later are the only versions supported now. All earlier versions are fully retired since June 15, 2022 & will stop working (Message center post for reference – MC350371).

It’s recommended to update to the latest Teams PowerShell Module version.

It connects but various errors are received on different cmdlets.

Sharing out few commands and errors that I had to update/replace after upgrading. (You must upgrade as these will not work with version 2 even)

First error I received is below where I had to replace below command snippet in my script:

$allskobclientpolicynull = Get-CsOnlineUser -Filter { (HostingProvider -eq ‘sipfed.online.lync.com’) -and (ClientPolicy -eq $null) -and (DirSyncEnabled -eq ‘True’) -and (Enabled -eq ‘True’)} -resultsize:unlimited | Select-Object -Property UserprincipalName, ClientPolicy, UserAccountControl

I had to change entire logic and get the users in by using below command snippet

$allusers = Get-CsOnlineUser |Select-Object DisplayName,ObjectId,UserPrincipalName,UserDirSyncEnabled,AccountEnabled,InterpretedUserType

$allusers = $allusers | where{$_.UserDirSyncEnabled -eq $true -and $_.AccountEnabled -eq $true -and $_.InterpretedUserType -eq ‘HybridOnlineTeamsOnlyUser’}

To filter out on Policy I had to use below:

[System.Collections.ArrayList]$collection = @()

foreach($u in $allusers){

$coll = “” | Select DisplayName,ObjectId,UserPrincipalName,UserDirSyncEnabled,AccountEnabled,InterpretedUserType,ClientPolicy,ExternalAccessPolicy

$coll.DisplayName = $u.DisplayName

$coll.ObjectId = $u.ObjectId

$coll.UserPrincipalName = $u.UserPrincipalName

$coll.UserDirSyncEnabled = $u.UserDirSyncEnabled

$coll.AccountEnabled = $u.AccountEnabled

$coll.InterpretedUserType = $u.InterpretedUserType

$getpol = Get-CsUserPolicyAssignment -Identity $u.UserPrincipalName # this the key cmdlet

if($getpol.PolicyName -contains $policy1){

$coll.ClientPolicy = “True”

}else{

$coll.ClientPolicy = “False”

}

if($getpol.PolicyName -contains $policy2){

$coll.ExternalAccessPolicy = “True”

}else{

$coll.ExternalAccessPolicy = “False”

}

$collection.Add($coll)

}

$allskobclientpolicynull = $collection | where{$_.ClientPolicy -eq $false}

$allskobexternalpolicynullordefault = $collection | where{$_.ExternalAccessPolicy -eq $false}

If you have used my previous script SKYPE Policy Compliance Script | Tech Wizard then these updates have to be made.

I will post the whole script in next blog post as still checking on one error and its mitigation.

Next error that came few days after is below:

Grant-CsClientPolicy -Identity $upn -PolicyName $policy1


I tried searching public documentation(nothing exist) and checking with our internal department who support Microsoft Teams if they know any thing about this failure/ mitigation.

If you are aware, please comment below on this post.

One of the other scripts in below link also broke

Available Team Numbers Report

$allnumbers = Get-CsOnlineTelephoneNumber -ResultSize 100000 | Select Id, ActivationState, CityCode,O365Region,InventoryType, TargetType, PortInOrderStatus


I had to replace it with below mitigation command:

$allnumbers =Get-CsPhoneNumberAssignment -Top 100000 | Select TelephoneNumber,NumberType,ActivationState,City,IsoCountryCode,IsoSubdivision,PortInOrderStatus,PstnAssignmentStatus,PstnPartnerName

Further below changes are also required to names of some attributes in later section of the script.


I will post this script as well in future blog post.

As I will find more errors myself or thru reports from others, I will update this Blog.

If you are still searching for solutions as some of the old cmdlets broke completely then this blog post will assist you on at least few of them that changed.

Thanks for reading …

Tech Wizard

 

https://techwizard.cloud

https://syscloudpro.com/

PowerShell Fast Track

Advertisement

2 thoughts on “What Broke after Teams Module Upgrade to version 4 ?

  1. Pingback: PowerShell – Available Team Numbers Report V2 | Tech Wizard

  2. Pingback: Available Team Numbers Report | Tech Wizard

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s