Microsoft Teams and Skype for Business thoughts and news

Tom Arbuthnot MVP
Tom Arbuthnot MCSM Communications

This site uses cookies

Find this blog useful? Please take a second to share, thanks!

Get-LyncNumberAssignment :Find #Lync Users/Objects by Phone Number/LineURI #PowerShell

Published 03/07/2013 - 49 Comments

Often in Lync it’s useful to understand if a number is assigned, or who/what is assigned a particular number. There isn’t really an easy way to do this out of the box. Numbers can be assigned to Users, Private Lines, Analog Devices, Common Area Phones, Exchange UM Contact Objects, Dial in Conference, Application Endpoints and Response Groups.

This script checks all these types for a number match, and outputs the data as objects allowing further manipulation.

Uses for script

    • Find out of a number is in use
    • Find all the numbers assigned from a particular range/country
    • Find all the objects in an environment with an assigned number, and their associated registrar pool (useful to see where common area, exchange UM and other contact objects home)

Download Here

You need to “dot source” the function into your session and you will need the Lync PowerShell Module. Here is the basic output


Finding all object with “+44” in their LineUri, sorting in order of LineURI and Format into a table


Finding all objects with any number assigned, Selecting Line URI, Registrar Pool and Type of Object, then sorting by type to see the different types



Hope you find it useful. Feedback welcome.


Tom Arbuthnot

Tom Arbuthnot

Principal Solutions Architect at Modality Systems
Tom Arbuthnot is Principal Solutions Architect at Unified Communications specialist Modality Systems. He is a Microsoft Certified Master and MVP, blogger, has a regular podcast with UCToday at and is a regular speaker at events including Microsoft TechEd and Ignite. He co-runs The Microsoft UC User Group London.


Ken Lasko - 03/07/2013 Reply

This is a fantastic tool. Very helpful way to find those “hidden” numbers that can cause “485 Ambiguous” issues when using Tel URIs with extensions.

Tom Pacyk - 03/07/2013 Reply

Great script, Tom. Thanks for sharing.

Dinesh - 03/07/2013 Reply

Awesome script, it will help to pull out entire Lync etc. numbers. thank you

Get-LyncNumber Assignment | GotSpeechGuy - 05/07/2013 Reply

[…] has a nifty little Lync PowerShell utility on his Lync’d Up Blog. The PowerShell script is called Get-LyncNumberAssignment and it helps you avoid those irritating “multiple results” error messages when trying to enable […]

Charbel Hanna - 08/07/2013 Reply

no comments, really useful script, thanks Tom

Jens Madsen - 09/07/2013 Reply

Will this work on Lync 2010? – when i fire the script against a Lync 2010 environment i get no output.

    Tom Arbuthnot - 10/07/2013 Reply

    Yes it should work against both 2010 and 2013, the cmdlets are the same. Have you loaded the function then run the function as per the instructions? Just running the script is not enough

      Jens Madsen - 24/07/2013 Reply

      Nice thank you

      Here’s i how to get it exported to a nice CSV

      get-lyncnumberassignment | select-object lineuri, displayname, sipuri, type, registrarpool | export-csv c:\numbers.csv

Paul - 11/07/2013 Reply

Great script Tom! Love your work!

Had to Google the way to ‘dot source’ it:


And the complete command to export it directly to CSV:

Get-LyncNumberAssignment | Select-Object LineUri, DisplayName, Type | Sort-Object LineUri | Export-Csv -Path C:\Temp\AllAssignedNumbers.csv

Balasaheb Ilag [MVP-Lync] - 08/10/2013 Reply

Hey Tom,

It’s really useful and essential script / tool.

I was working project where many user has same LineURL and due to that they were unable to make Lync call (peer-to-peer).
For few single users we can search duplicate LineURI through Cmdlet:
Get-CsUser | where {$_.LineURI -eq “tel:+11122233345;ext=1234”}
However to track all users LineURI is very difficult.
Thank you for making life easier of Lync Administrator ?

Appreciate your all efforts.

Balasaheb Ilag [MVP-Lync]

    Tom Arbuthnot - 09/10/2013 Reply

    Thanks for the comment! glad it’s useful


Divyasankar - 08/10/2013 Reply

please help i am unable to get the output of the script..please guide me

    Tom Arbuthnot - 09/10/2013 Reply

    sorry, going to need more than that to help….

    Rajasekar N - 19/12/2013 Reply


    Today i was trying this script and let me say how to execute.

    1. Download the script and place it on your lync server c:\ drive
    2. Open lync powershell command and cd\ to come out from all directories.
    3. PS C:\>. c:\Get-LyncNumberAssignment-0.5.ps1 say enter
    4. Get-LyncNumberAssignment (Now you will find the command) enter, it will list all user with their Line URI details.

    Hope it helps and a big thanks to Tom for his wonderful job.


leith magon - 04/02/2014 Reply

excellent post. this is a fantastic cmdlet

Elton - 16/06/2014 Reply

Don’t work here :(

Just return to prompt without any error or message.


    Tom Arbuthnot - 17/06/2014 Reply

    You have to dot source the function then run the cmdlet, can you confirm you have done both?


Elton - 16/06/2014 Reply

It doesn’t work here. No error no output just return to prompt again :(

Thanks for any help

Stacey - 17/06/2014 Reply

Hey Tom,
Excellent info! Is there a way to run the script as a Scheduled Task, we’re having trouble with the dot-sourcing in the task?


    Tom Arbuthnot - 18/06/2014 Reply

    Yes, it can get bit convoluted. Best way is to write ScriptA, that calls my function. then run ScriptA as the scheduled task.


    . c:\PowerShell\Get-LyncNumberAssignement
    Get-LyncNumberAssignment -Parameters

    Hope that makes sense


Steve-O - 20/06/2014 Reply

Thanks for the script! Helped me figure out a pesky URI conflict

Michael - 28/07/2014 Reply

Hi Tom,

The link seems to be broken.. can you fix that up please?


    Tom Arbuthnot - 28/07/2014 Reply

    Thanks for letting me know Michael, I’ve moved all my code to github. have updated the link



Nick - 14/08/2014 Reply

Hi Tom,

Just a suggestion (something I ran into today). Meeting rooms can also have sip addresses/LineURIs assigned to them.

Get-CSMeetingRoom in Lync.

Thanks for taking the time to write the script, very helpful!

    Tom Arbuthnot - 15/08/2014 Reply

    Thanks Nick, this script is due an update. I’ll add this to the list

    Appreciate the feedback


Kevin - 09/10/2014 Reply

just trying to dot source the script is giving missing expressions errors from multiple machines with Lync 2010 installed

Richard - 17/03/2015 Reply

Tom: it seems in the 2 environments I have, the script behaves incorrectly.

Both these environments are multi-pool systems with mixed lync 2010 / 2013 and SBA registrars.

No matter what I type for the parameter: -number “+XXXXXXXXX” , I always get returned all the objects with ANY kind of LineURIs. Regardless if I include the “+” in the -number condition, or if I only use digits there.

    Richard - 17/03/2015 Reply

    Just for the reference, I used the version found on Github v0.5

      Richard - 26/03/2015 Reply

      Do you need any more input to acknowledge this problem?

        Richard - 17/04/2015 Reply

        Seems nobody is reading this blog anyway :S

          Richard - 23/02/2017 Reply

          Ok, after 2 years I read the hint from another blog reader, that this script is unusable if run from a remote Lync PS session. Good to know, as not an obvious defect at the first sight. Not even for the 2nd and 3rd sight either. Too bad most people wont RDP to the Frontends everytime when a script needs to be run, if Remote PS is the only access method for them.

          Ps. Not expecting feedback from the owner of the blog, I already had nice chat with myself in the past 2 years here.

Tim - 29/06/2015 Reply

Thanks – this has been a tremendous help!

Danny Innes - 09/07/2015 Reply

DO you now if there is any Lync Number assignment software rather than having to use PS?

ron - 26/07/2015 Reply

Hello Tom,

Thanks a lot for this great script! I have trouble using this via remote power shell session. It returns all numbers/contacts instead of the specific number I’m looking for. Is this a limitation or am I doing something wrong?


    Tom Arbuthnot - 02/08/2015 Reply

    hey Ron, Can’t say I’ve tried it on a remote session, so its possibly script related. I’ll add it to the wish list

Jordan Mills - 25/01/2016 Reply

Well I normally gripe about details in functions I see posted (using write-host, etc, just call me the powershell Nazi)… but that’s a pretty well-written function. And useful. Thanks! I was wondering about doing a general AD search though, but I don’t have a lync/sfb environment complex enough to test this well. Could you do Get-AdObject -filter { msRTCSIP-Line -like “$url” } -Properties msRTCSIP-Line and have it return what you need? I think all of those objects that each of those cmdlets search for are ad objects.

UC Unleashed » Function: Get-CsPhoneNumberAssignment – Find Where a Number is Assigned in Skype for Business - 22/01/2018 Reply

[…] I know that others have done similar things, notably Tom Arbuthnot’s Get-LyncNumberAssignment :Find #Lync Users/Objects by Phone Number/LineURI #PowerShell and Amanda Debler’s Is that Skype for Business (Lync) Number Free?, as well as other phone […]

Leave a Reply:


Weekly Email Update 
of all the key 
Microsoft Teams and Skype for Business News
every Tuesday

No Spam ever, I promise - Tom