There is no easy way to view your users extensions on Skype For Business control panel. In fact provisioning new users with new extensions is nightmare without knowing which extensions are free and what range are we at so we created a email report to let us know our users extensions.
Possibilities are endless with this script as this takes care of your leg work for using this as base for your script. You may ask how? well you can use this script to go through your extension range and find out what extensions are not being used. Well you might ask if we are going in sequential why would we have this issue? well cause your employees leave and you have a broken chain in your sequential extension assignments.
PowerShell Code below: –
#Create table and populate users properties
$table = @()
#Get users who have Enterprise Voice Enabled and select Name, LineURI and #EnterpriseVoiceEnabled columns
$users = Get-CsUser -Filter {EnterpriseVoiceEnabled -eq $true} | `
Select DisplayName, LineURI, EnterpriseVoiceEnabled
#Loop through each users
foreach($user in $users){
#Get Name from the user list for each user
$name = $user.DisplayName
#Grab extension which is after = sign and grab the 1st part after =
$ext = $user.LineURI.Split("=")[1]
#Grab value of EnterpriceVoiceEnabled in this case it will be always True
#cause our initial search only includes Enterprise Enabled users.
$entvoice = $user.EnterpriseVoiceEnabled
#Add each columns with property for users.
$objAverage = New-Object System.Object
$objAverage | Add-Member -type NoteProperty -name "User" -value $name
$objAverage | Add-Member -type NoteProperty -name "Extension" -value $ext
$objAverage | Add-Member -type NoteProperty -name "Enterprise Voice" -value $entvoice
#Add them to table
$table += $objAverage
#Format the table. This is useless as we are sending email from below $body
$table | Format-Table -AutoSize
}
#CSS formatting
$a = "<style>"
$a = $a + "BODY{background-color:white;}"
$a = $a + "TABLE{border-width: 2px;border-style: solid;`
border-color: black;border-collapse: collapse;}"
$a = $a + "TH{border-width: 2px;padding: 2px;`
border-style: solid;border-color: black;background-color:GoldenRod}"
$a = $a + "TD{border-width: 2px;padding: 2px;border-style: `
solid;border-color: black;background-color:palegoldenrod}"
$a = $a + "</style>"
##############Change your SMTP Details Start###
#Your SMTP server
$smtpServer = "intermailserver.usyse.com"
#Your from address
$from = "Do_Not_Reply@usyse.com"
$To = "me@usyse.com", "you@usyse.com"
$CC = "someone@usyse.com"
##############Change your SMTP Details Ends###
$Subject = "Skype For Business Extensions"
$Body = "Skype For Business Extension Details<br>
<br>
"
#Here I am sorting it out with Extension
$Body += $table | Sort-Object Extension | ConvertTo-Html -head $a
$Body += "<br><br>"
#$message.Body += " <br>"
#$message.Body += " <br>"
$Body += " "
#Send email finally
Send-MailMessage -To $to -Subject $subject -Body $body -SmtpServer $smtpserver -From $from -BodyAsHtml -Cc $CC
And here is the fancy looking script with color coding !


And your final result will be something like this :-

Still need help? feel free to contact us via our managed services page. Managed Services