This week I created a new Microsoft Teams Direct Routing Setup for our branch office in Switzerland by using the Sunrise Business Voice Cloud Connect as SIP Trunk.

The setup I did on a new installed Windows 10 computer. Therefore I first had to install the latest version from the Microsoft Teams cmdlets module for Windows PowerShell, version 3.1.0 at the moment.

Install-Module -Name MicrosoftTeams
Import-Module MicrosoftTeams


After that I connected to Teams and wanted to add first a new PSTN Usage for this SIP Trunk.

Connect-MicrosoftTeams
Set-CsOnlinePstnUsage -Identity Global -Usage @{Add=”Sunrise Unlimited Test”}

As result I got the following error message

Set-CsOnlinePstnUsage : Unable to cast object of type ‘System.Management.Automation.PSListModifier’ to type ‘System.String’.


Creating the PSTN Usage by using the Microsoft Teams admin center works fine, so next I tried to add a new Voice Route.

New-CsOnlineVoiceRoute -Identity “Sunrise Unlimited Test” -NumberPattern “.*” -OnlinePstnGatewayList sbc.cloudsbv.sunrise.ch -Priority 0 -OnlinePstnUsages “Sunrise Unlimited Test”


Here I got the same error message as before for the PSTN usage.


As the Cmdlets works fine on an old computer, I removed the Microsoft Teams module on the new computer by executing the follwing command.

Uninstall-Module MicrosoftTeams -Allversions

To first check your installed version you can use
Get-InstalledModule -Name *Team*


The version on the old computer was 2.3.2-preview, so I installed also this version on the new computer, to test if this version also works on the new one by executing the following command.

Install-Module -Name MicrosoftTeams -RequiredVersion 2.3.2-preview -AllowPrerelease

All versions you will see under the following link
https://www.powershellgallery.com/packages/MicrosoftTeams


With that old version all the Cmdlets works fine again and even after updating this old version to the latest version I tried first, by running

Update-Module -Name MicrosoftTeams

still works fine.


So it seems that in the latest version 3.1.0 something is missing from the old modules and still present from the old one after updating it to the latest version.


Links

Install Microsoft Teams PowerShell Module
https://docs.microsoft.com/en-us/microsoftteams/teams-powershell-install

Microsoft Teams cmdlets module for Windows PowerShell and PowerShell Core
https://www.powershellgallery.com/packages/MicrosoftTeams

Remove-Module
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/remove-module?view=powershell-7.2

Get-InstalledModule
https://docs.microsoft.com/en-us/powershell/module/powershellget/get-installedmodule?view=powershell-7.2

Why do we need -AllowClobber?
https://pkisharp.github.io/ACMESharp-docs/Why-AllowClobber.html