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.
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 “email@example.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….