msunified.net

Technical blog about Exchange, OCS and Lync by Ståle Hansen

  • TENA14

  • Proud contributor and fan of

  • wordpress visitors
    • 880,131 views since april 09

Lync 2010/2013 Script to find available numbers in a Lync deployment

Posted by Ståle Hansen on 23/04/2013

LyncPSHaving 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.

Whats New?

  • 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

Output

Where to download it?

You can get the script here: http://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

Prerequisites

  • 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:mainswitchboard@ateaedge.no
  • 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

Unassigned

10 Responses to “Lync 2010/2013 Script to find available numbers in a Lync deployment”

  1. I would suggest using
    Set-ExecutionPolicy RemoteSigned
    instead of Unrestricted

  2. Great script!

  3. [...] Lync 2010/2013 Script to find available numbers in a Lync deployment – 23-Apr-2013 [...]

  4. [...] Lync 2010/2013 Script to find available numbers in a Lync deployment: http://msunified.net/2013/04/23/lync-20102013-script-to-find-available-numbers-in-a-lync-deployment/ [...]

  5. […] Lync 2010/2013 Script to find available numbers in a Lync deployment […]

  6. […] http://msunified.net/2013/04/23/lync-20102013-script-to-find-available-numbers-in-a-lync-deployment/ […]

  7. […] http://www.lyncconf.com/SessionDetail.aspx?id=9438Abstract: Ståle Hansen, the creator of Get-UnusedNumbers PowerShell script, walks through how phone number management is done throughout different Lync […]

  8. […] some major changes since it was first released in January 2011 on msunified.net , V1 article, V2 article. I will go through use cases, examples and explain the script in future posts. But here are the […]

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 )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

Join 58 other followers

%d bloggers like this: