PowerShell – Available Team Numbers Report V2

If you have been following my blog then you might have used the script to report on all available Team numbers in your tenant.

Available Team Numbers Report | Tech Wizard

As Microsoft Team module and attributes have changed in the backend so above solution will not work correctly.

We have modified the existing solution as mentioned in the previous blog post.

What Broke after Teams Module Upgrade to version 4 ? | Tech Wizard


Solution is available on GITHUB as well as has been uploaded to PowerShell Gallery.

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

Process for executing the script and other parts remains same, only difference is in the below code:

$allnumbers = Get-CsOnlineTelephoneNumber -ResultSize 100000 | Select Id, ActivationState, CityCode,O365Region,InventoryType, TargetType, PortInOrderStatus


I had to replace it with below mitigation command:

$allnumbers =Get-CsPhoneNumberAssignment -Top 100000 | Select TelephoneNumber,NumberType,ActivationState,City,IsoCountryCode,IsoSubdivision,PortInOrderStatus,PstnAssignmentStatus,PstnPartnerName

Further below changes and also changes to names of some attributes later in the script.


Execution Steps:

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, little change from version 1 report.


Earlier (previous version Script) was utilizing Get-CsOnlineTelephoneNumber for fetching all numbers but newer version is using Get-CsPhoneNumberAssignment.

Note: I have replaced the old script with this, also keeping the older version in PowerShell gallery, incase you need to reference it.

 

 

Thanks for reading and downloading…

Tech Wizard

 

https://techwizard.cloud

https://syscloudpro.com/

PowerShell Fast Track

 

One thought on “PowerShell – Available Team Numbers Report V2

  1. Pingback: Available Team Numbers Report | Tech Wizard

Leave a comment