Updated Get-SfBNumbers.ps1

As shown at Microsoft Ignite 2015 this script handles phone numbers in a Skype for Business deployment. I have gotten some great feedback on the script and now I have updated the script with new features, fixes and optimizations. Let me know how the script works for you in the comment field below

Here are version 1.0 changes

  • Added and verified $ReportPieChartHTML parameter and set it to $True as default
  • Fixed bug when connecting to SQL monitoring CDR databases with named instances and mirrored SQL
  • Optimized adding user activity to internal database and added parameter $ReportUserActivity that is default set to $False that will skip it since it may take up to 20 minutes
  • Added and verified options to automatically classify numbers to Gold and Silver with parameter $AutoclassifyNumbers that is default set to $True
  • Added option to classify Bronze numbers with parameter $ReserveBronzeNumbers which is default set to $False, do not run
  • Added check if Server 2010 to skip Get-CsMeetingRooms as the cmdlet does not exist in 2010
  • Added option to specify extension length with parameter $ExtensionLength that is default set to 4

Download the script

Link: https://gallery.technet.microsoft.com/lync/Get-Skype-for-Business-f2af9408

Watch the recording of the session at Ignite


Get-AssignedLineURI has been updated twice

Get-AssignedLineURI has seen two updated since my previous post. The first update came back in June, and the second one just yesterday.

I am trying my best to add information I find useful, and incorporate these as soon as I have time. My latest additions are most tied to license counting. So many of my customers have the headace of knowing how many licenses the have, what they have deployed and if the required functionality is being used.

My latest addition is a connection to the monitor database, to verify user last logon, and the use of conferencing for a particular user. I also copied the send_email function from the backup script. This script can now be run as a task, and send a report to a desired mail address.

Here’s a short list of my updates:

V 3.6 – June 2015:

  • New feature: If a Monitor database is detected, and connection is possible, the script will now add “last log on” and “last conference initiated” information to the output

V 3.7 – September 2015

  • New feature: LicinfoHTML -> A parameter to gather license info and add it to the html output
  • New feature: Send the report in an e-mail


License count in HTML output

One of the new features I would like to highlight is the license count in the HTML output.

By using -LicInfoHTML and -CreateHTMLOutput togehter, you should get a summary on top of the HTML report similar to the following image:

report summary

Listed above are the total number of users, how many of them have only peer-2-peer functionality, how many have the enterprise license (conferencing) and how many enterprise voice enabled users there are. Along with the previous information added by counting devices.

Using Monitor Data

I added the -usemonitordatabase back in June, but forgot to post about it. But it is a very useful addition for gathering information about your deployment. Using this switch requires access to the monitor database (both user rights and network access), and will increase the time taken to complete the script.

Connecting to the Monitor Database adds a wealth of information, but I have chosen to focus on three pieces of the puzzle. The last logon preformed by the user, the last time he/she initiated a conference and whether or not the user has an enterprise license. Adding these as columns to the end of the line for each user, you should get information similar to the following:


In the example above you can see there is a user who has not been logged in for the duration of the log files, there are users who initiates conferences, and there are users not assigned with conference rights.

This information can be useful when deciding who gets to keep their enterprise license or not (if saving cost is an issue), identify users who do not log on and ccould be disabled or maybe encouraged to log on and participate.

Two words of warning regarding the information above:

  • This report is based upon logged data. Check your retention time to figure out how “valid” the above statements are. Needles to say, the longer the period of data history, the more accurate the report is.
  • If a user has not logged in for a while, that is no reason to disable that user. But could be a reason to investigate if the user should be disabled or not. A long absence from logging in can be due to Holiday, maternity/paternity leave or other valid reasons. (Again, depending on your history of data, this information can be inaccurate)

I use the “last logged in” information mostly during a deployment of a new customer. It can easily identify late adopters of the solution.


The script is available for download at the Technet Gallery

I hope you find these changes useful. And as always, I appreciate feedback ;)

Get-AssignedLineURI.ps1 v 3_5 released

I am still going through my scripts and verifying how they work on Skype for Business server. Get-AssignedLineURI was next in line. And as with my other scripts, I have taken the time to fix minor bugs and add features to the releases. Here are the highlights of version 3.5:

  • Code Cleanup: Moving parameters into sets, to avoid unintentional errors
  • New feature: Listing users enabled for EV, but without a lineURI present
  • New feature: Listing users disabled for EV, but with a lineURI present
  • More information: Added sip domain to the output of the search
  • Beta feature: Get the unassigned numbers from CsUnassignedNumber and quicly identify available numbers, First, first 10 or entire list
  • Beta feature: Manual number range for the unused assigned section

Moving parameters into sets, to avoid unintentional errors

As the scripts grow, they tend to have more switches added. Some of these could actually make the other not work. And to avoid conflicting switches, I have moved them into sets. Run “get-help .\get-assignedlineuri.ps1” to get a clear view of the possible combinations (or read the help file).

Listing users enabled for EV, but without a lineURI present and Listing users disabled for EV, but with a lineURI present

It is not uncommon  to make mistakes when working with EV. Two of the most common mistakes I run into is when admins disable enterprise voice and forget to remove it from the LineURI, or removes the LineURI and forget to disable EV. The first scenario doesn’t free up the number, and the second scenario still requires a EV license for the user. I used to run one-liners at deployments, to identify these “errors”, but decided I could use this script instead.

To identify if you have one the following issues, simply use the -ShowSummaryInShell switch:


To identify these objects, use the -CreateHTMLOutput switch and study the outputfile:




Get the unassigned numbers from CsUnassignedNumber range

As the script was made to gather all the lineuri’s in the deployment, it was easy to incorporate a switch to identify non-used numbers based of the unassigned range:


Manual number range for the unused assigned section

And while I was at it, I created an option to provide a manual start and end range. This way it’s is easy to find a number in a specific range, and the script doesn’t have to go through all your ranges to find just on number.



License information

I have also gone through the license information output, and I think the new output makes more sense:



The script is available for download at the Technet Gallery

I hope you find these changes useful. And as always, I appreciate feedback ;)

V 3_4 of Search-lineuri.ps1 released

I have gone through this script, and verified it’s compatibility with Skype for Business server. And while doing so, and I did a few changes for the script. Here are the highlights of v 3.4:

  • Cleanup: Using paramter sets to seperate the different options (see comment below)
  • Bugfix: URIsearch is now mandatory when using -search parameter
  • Change: Default directory is now “UCDoc” (see comment below)
  • Change: Only one parameter for filename: $fileXML
  • Bugfix: Running a test, to avoid known issues with get-csmeetingroom and Lync 2010  (see comment below)

Cleanup: Using paramter sets to seperate the different options

The script have a lot of different switches, which really should not be mixed. In previous versions it was up to the user to avoid these errors. New parameter sets should now prevent a bad mix from ever happening.

Default directory is now “UCDoc”

The default path used to be “c:\Lync Documentation”. I changed the path to “c:\UCDoc” as a more neutral choice.

Running a test, to avoid known issues with get-csmeetingroom and Lync 2010

To avoid blood red text (on in some instances script hangs), I now run a test for the software version before running get-csmeetingroom (not available in Lync 2010 versions).

Hope find these updates useful, and I do appreciate feedback if you have questions or suggestions.

The script can be downloaded from the Technet Gallery

Releasing Get-SfBNumbers.ps1

As shown at Microsoft Ignite 2015 here is the script demoed called Get-SfBNumbers.net. At this time the tool is in beta since it has only been tested in a handfull of deployments.



Link: https://gallery.technet.microsoft.com/lync/Get-Skype-for-Business-f2af9408


This script will get the next available number of any provided number range from

  • Unassinged Numbers
  • array in the script
  • parameter input when running the script

It will check for

  • disabled users in Active Directory
  • connect to the LcsCDR to get users that has not logged on for 30 days or more
  • Connect to LcsCDR to check for activity on numbers, both unassigned and assigned

It supports

  • Lync Server 2010, Lync Server 2013, Skype for Business Server 2015
  • Reservation of numbers based on categories like Gold, Silver, Bronze, Special and Excluded
    • From Array in the script or Unassigned Numbers
  • Reservations of number ranges within larger number ranges for special services like future callcenter or response groups
  • Retention of numbers based on disabled in Active Directory, last logon time and activity on numbers

Reporting supported

  • Default behaviour is GridView with all numbers and summary in the PowerShell window
  • Export to of all information to CSV
  • Create a summary in PieChart as HTML



Speaking at TechED EU 2014

Did you know both Ståle and I are speaking at TechED in Barcelona this year?

Ståle is having a session on how to succeed with mobile devices and enterprise voice: http://msunified.net/2014/08/21/speaking-at-teched-europe-2014/

I will be presenting a session on backup and restore of Lync: http://tech.rundtomrundt.com/2014/08/speaking-at-teched-europe-2014.html

We’re both really excited about this opportunity, and we hope to see you in Barcelona

Get-AssignedLineURI updated

I couldn’t just update the search-lineuri without going through the get-assignedlineuri.ps1 as well?

I have rewritten the script in much the same way as I wrote search script (parts of the code are now almost identical), and it saved me a lot of “space” and time. I have tried to reduce the number of times I gather information to a minimum, and to carry the found information through all the different functions and jobs.

Highlights from this update includes:

  • BUGFIX: CommonAreaPhone error fixed. Thanks to Peter
  • CODE CHANGE: crated new functions, tried to make them work smarter together.
  • NEW FEATURE: Progress bar to give an indication of progress in huge systems
  • DELETED FEATURE: -splitext is no longer a valid option, but run on all queries by default
  • BETA FEATURE: Summarize the numbers of Licenses required. Beta only, feedback wanted!


REQUEST: If you know exactly how licensing work, please test my beta portion of the script and see if it is correct. It is built upon the following assumptions:

Basic CAL: Is a user enabled for Lync, but has no conferencing policy which allows 3-party audio, video or sharing. Nor is the user able to schedule a conference (if anyone knows exactly which settings are behind the shift from basic to enterprise, please explain :)

Enterprise CAL: A user enabled for Lync with all functions, with out enterprise voice

Basic CAL, and Plus CAL: The same as a Basic CAL, but this user has Enterprise Voice enabled

Enterprise CAL ans Plus CAL: All the good things in one basket, no restrictions.

If you know my assumptions are wrong, have something to add or suggest, please let me know.