Having worked on a couple of Enterprise Voice deployments since the launch of Lync Server 2013 I am still missing a feature that I honestly thought would be incorporated in to Lync by now. It is the ability to find unused available numbers in a given number range assigned to the Lync Server based on Unassigned Numbers. I even hoped it would be possible to assign a teluri to users through a drop down list in the Silverlight GUI since the information is available in the server. I hope this will be available in a future Cumulative Update.
This is almost how I wrote it back in january 2011 when I created the List-UnusedNumber.ps1 script. This is still true and I have therefore revitalized the old script and upgraded it and tested it on Lync 2013. The original script was also featured on the Lync PowerShell blog, which was a huge thing for me.
- The entire script is a function and is ready to be reused in scripts to enable users for Enteprise Voice
- The function can take a Unassinged Number Identity and return the value of a new unassigned number
- If you don’t provide input to the function it will go through all Unassigned Numbers in the deployment
- It will check if there is no Unassigned Number range defined, and point you to TechNet for how to configure it
- Support for numbers larger than 10 digits added
- A problem with the old script was that it did not support numbers with more than 10 digits (Int32)
- I have rewritten the code to create a list of the number range that supports Int64 values which should be enough digits for phone numbers
- I recommend working with the numbers in full E.164 format to be able to support numbers with different countrycode length
What does it do?
- Search through all Objects with a Lync number (DID) and tell you based on Unassigned Numbers what numbers are available and can be assigned to new users and services
- It will return all available numbers if you don’t specify a specific Unassigned Number Range
- It will return the second available number if you specify a Unassigned Number Identity
- It is the second because it is always smart to reserve the first number on the trunk to other roles or avoid using it at all since it is probably the main number on the trunk
- It is easy to use in existing scripts for enabling users for Enterprise Voice to automate the process
Where to download it?
You can get the script here: https://msunified.net/lyncdownloads/script-get-unusednumbers-ps1/
How to use it
- No input is required if you just want to go through all you Unassigned Number ranges
- To change what Unassigned Number range to pick number from change the following code at the end of the script, about line 160
- $FirstNumber=Get-Unused #Example 1: will return all unassigned number range and all numbers
- $FirstNumber=Get-Unused ”<Your Unassigned Number Identity>” #Example 2: will return second next available number from the range you specify
- Write-Host #to give some air in the output
- $FirstNumber #outputs the return value from the function
- Define Exchange UM or a Announcement Service to use with your Unassigned Numbers
- New-CsAnnouncement-Parent service:ApplicationServer:aeolyfe1.ateaedge.no -Name “Unassigned Number” -TextToSpeechPrompt “The number you have reached is not in use” -Language “en-US” -TargetUri sip:email@example.com
- In Lync Control Panel go to Voice Features->Unassigned Numbers and create your range
- The script use E.164 format for the numbers so the range should be defined in that format
- The script is not signed so you may need to do Set-ExecutionPolicy RemoteSigned