This script queries Skype for Business or Lync for all assigned numbers and displays in a formatted table with the option to export to CSV. During processing LineURI's are run against a regex pattern to extract the DDI/DID and the extension to a separate column.

Numbers Queried: LineURI, Private Line, Analouge Lines, Common Area Phones, RGS Workflows, Exchange UM Contacts, Trusted Applications and Conferencing Numbers. Meeting Rooms

If you are looking for a GUI based version see Admin Tools