Available Team Numbers Report

Our Voice team needs a report of available numbers in Microsoft teams, they can see that in the portal as shown below but cannot see the users to whom the numbers are assigned.

So I have created a simple PowerShell spell for them that can achieve this à save the report in report folder as well as send it to their email.

Prerequisites: latest Microsoft Teams Module

Script can be downloaded from PowerShell gallery or you can get it from git.

Git link : https://github.com/VikasSukhija/Downloads/blob/master/AvailableTeamNumbersReport.ps1

PowerShell Gallery: https://www.powershellgallery.com/packages/AvailableTeamNumbersReport

Install-Script -Name AvailableTeamNumbersReport

Run the script as .\AvailableTeamNumbersReport.ps1 -smtpserver “smtpserver.labtest.com” -from “Donotreply@labtest.com” -erroremail “report@labtest.com”

Enter the Team administrator credentials, it will connect to Microsoft teams, will start extracting the available numbers and check for existing assigned numbers along with users to whom it is assigned.

Logs and report will be saved in logs and report folder respectively.

Report will also be sent on the email address you entered in the argument.

Here is the report snippet that you will get:

Script is utilizing Get-CsOnlineTelephoneNumber for fetching all numbers, Get-CsOnlineUser to get users where line uri is not null.

After that looping/parsing one over another to fetch the report.


Thanks for reading….

Tech Wizard



PowerShell Cheat Book

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 )

Google photo

You are commenting using your Google 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