Searching for that LineURI

Organizing and maintaining your entire dial-plan in Lync can at times be tough work. Easy enough when you're a small company, but try keeping score when reach 3-4000 DID's in your system.

I've been working closely with a customer of that size lately, and they asked me if there was anything I could do to help them when they had to allocate a new number (or move) to one of their employees. 

It turned out they were not able to keep score of available numbers, or where certain numbers were assigned. 

The first task was simple enough. I showed them Ståle Hansen's ( script for identifying unused numbers. Big hit! 

However, the customer also wanted a quick way of identifying where a number was assigned, and if possible, to do the search with a wildcard (the lync client only returns an identity when a normalization rule has been matched).

I gave it a thought and created the following script to do a search through powershell. (download and rename to .ps1 to run).

The script asks for an input, then adds * to the input to make it a "wildcard" search.
It will then run several "get-" commands to see if any matches can be found within a known user, device, service or application.

The screen shot above is only the beginning of the script, but it should give you an idea of what it's doing.

When the script is run in a live environment, it's output could look like this:

In my demo environment the search only returned 1 user, but if there were more matches to the 4 digits entered in the search, there would be more hits.

I hope you find this script useful, as I did. In one my upcoming posts, I will post a script to export all used numbers to a searchable html file.