Script: Get Microsoft Teams Assigned Numbers


Script Overview

This script queries Microsoft Teams for assigned numbers and displays them in a formatted table with the option to export to CSV.

During processing LineURI’s are run against a regex pattern to extract the DDI/DID and the extension to a separate column.

This script collects Microsoft Teams objects including: Users, Meeting Rooms, Online Application Instances (Resource Accounts).


Download the script over on GitHub.

This script does not collect objects from on-premises environments even if in hybrid, instead use this script.


      • Thank very much for posting this. Extremely useful. I have already started using it.

        Is there another script that could show all the unassigned numbers only?

        Many thanks,

        • Thanks for your feedback. Are you looking for something that maintains a database of all your phone numbers and tracks what is and isn’t assigned? I built something like that for SfB, but I havent ported it to Teams yet.

          • Thank you very much for the reply. I have used the script of yours which is amazing. What I am looking for is a script which list all unassigned numbers to assigned to new staff members. However, that script you mentioned about the database of phone numbers and tracks what is and isn’t assigned, sounds amazing.

            Looking forward to your reply.


Please enter your comment!
Please enter your name here