• Eric Marsi

PowerShell Script: Check Configuration and/or Force Provision of Teams Direct Routing Users

Updated: Mar 25


NOTE: This post is an extension of my Knowledge Base (KB) - Microsoft Teams Migration Issues & Fixes. To go there, CLICK HERE


PSA 3/4/2021 - V1 of this script will no longer work due to Microsoft changing the way you connect to Teams Online. This has been updated in V1.1 below!


Disclaimer: Please use this at your own risk as I do not take warranty in this script. I have verified that every function is working as expected when building this, but still want to make this disclaimer.


This is my first release of any form of a PowerShell script to the public which is very exciting! This script was created to assist organizations that are running into issues when provisioning new Teams Direct Routing Users. One of the many issues that occurs is that there is no dial pad in the desktop Teams client and this script serves the purpose of verifying your user's configuration and can attempt to force provision them.

Prerequisites

  • You will need to allow unsigned scripts with the following command: Set-ExecutionPolicy -ExecutionPolicy Unrestricted

  • The Script will make sure that it is ran as an admin

  • The Script will make sure you are running at least PowerShell 5.1

  • The Script will make sure you have the MicrosoftTeams Module, if not it will attempt to install it

Use

  1. Upon launching the script, the script will run through the prerequisites above

  2. The script will then connect to Microsoft Teams PowerShell. You will see a login prompt appear asking for your Global Admin/Teams Service Admin account credentials. (This supports MFA)

  3. A prompt will appear asking you to enter a UPN of the Teams user you wish to test for a valid configuration. Enter this in in User@domain.com form

  4. The script will now run its user checks against that given user and output the results into the console shell

  5. If the user passes all checks, a prompt will appear asking "Would you like to force provisioning for $($User.DisplayName) using the above commands to attempt to get a dial pad sooner? (Y/N)"

  6. If you press Y, a Set-CsUser and a Grant-CsOnlineVoiceRoutingPolicy command will be ran against the user to set the EXACT SAME values that they had at the beginning of the process. This is in an attempt to force user provisioning.

  7. If you select N, the script will then ask if you want to run it for another user.

  8. If you select Y to the run again prompt, the script will reset back to Step 3 above.

  9. If you select N, the script will remove the Teams Online PowerShell Session and terminate.

  10. If during Step 4, the user has some form of a validation error, it will state what is wrong with the user and then proceed to Step 7 above.

Use Video


The below video shows the script working with all 3 modes:

  • A correctly configured user with an attempt to force provisioning of a dial pad

  • A correctly configured user without attempting to re-provision

  • An incorrectly configured user

Limitations

  • The script can only be ran against one user at a time currently. It will loop on itself so you can continue testing new users. To be fixed in a later release.

  • OnPremLineURI does not currently support ;ext=

Features for Future Releases

  • The ability to import then check/provision multiple users via a CSV

  • Add a check so that if the user came from on-prem and wasn't just a new user in the cloud, check that OnPremOptionFlags of 385 is there

  • (Get-CsOnlineUser -Identity user@domain.com).OnPremOptionFlags

  • Add support for OnPremLineURI for ;ext=

  • Add check to not force the onpremlineuri if it is set in local ad


Download

  • Verson 1.1 - Release Date: 3/4/2021

  • Updated to use the new Connect-MicrosoftTeams Function

TestTeamsDRUser - V1.1
.zip
Download ZIP • 2KB
  • Verson 1.0 - Release Date: 2/28/2021

  • V1 of this script will no longer work due to Microsoft changing the way you connect to Teams Online. This has been updated in V1.1!

TestTeamsDRUser -V1
.zip
Download ZIP • 2KB

914 views0 comments