Teams administrations who have been using Set-CsUser (https://docs.microsoft.com/en-us/powershell/module/skype/set-csuser?view=skype-ps) to configure Microsoft Teams users’ voice settings will notice that it has stopped working as Microsoft has indicated early in 2022 that will be deprecated. The replacement for this cmdlet is the Set-CsPhoneNumberAssignment (https://docs.microsoft.com/en-us/powershell/module/teams/set-csphonenumberassignment?view=teams-ps), which has a few changes I would like to quickly highlight.
This first example is the set of Set-CsUser cmdlets I use for a client who has Teams with Direct Routing:
$usernameUPN = “jsmith@contoso.com”
$extension = “tel:+14165550296;ext=296”
Set-CsUser -Identity $usernameUPN -EnterpriseVoiceEnabled $true -HostedVoiceMail $true -LineURI $extension
Grant-CsTenantDialPlan -PolicyName Toronto -Identity (Get-CsOnlineUser $usernameUPN).SipAddress
Grant-CsOnlineVoiceRoutingPolicy -Identity $usernameUPN -PolicyName “Toronto”
Get-CsOnlineUser -Identity $usernameUPN | FL *uri*,*voice*,*dial*
The following is the updated cmdlet that uses Set-CsPhoneNumberAssignment:
$usernameUPN = “jsmith@contoso.com”
$extension = “+14165550296;ext=296”
Set-CsPhoneNumberAssignment -Identity $usernameUPN -PhoneNumber $extension -PhoneNumberType DirectRouting
Grant-CsTenantDialPlan -PolicyName Toronto -Identity (Get-CsOnlineUser $usernameUPN).SipAddress
Grant-CsOnlineVoiceRoutingPolicy -Identity $usernameUPN -PolicyName “Toronto”
Get-CsOnlineUser -Identity $usernameUPN | FL *uri*,*voice*,*dial*
The difference here is that there is no need to set the EnterpriseVoiceEnabled as true because when you assign a phone number the EnterpriseVoiceEnabled flag is automatically set to True. The provided number also no longer accepts tel:.
Hope this provides a quick answer to anyone who may have realized their Set-CsUser cmdlets no longer work.
I will also be updating my Teams import script from this previous post:
PowerShell script for exporting Microsoft Teams user configuration to an Excel and importing user configuration with updated Excel file
https://blog.terenceluk.com/2022/05/powershell-script-for-exporting.html