How to change Skype for Business default toll number with PowerShell by Bas Wijdenes

Summary

We have a customer who is spread all over the world. They are all in one joint Office 365 tenant all over the world. The advantage of this is that everything is in one place, the disadvantage of this is that you run into land-bound things.

Think of the time zones, usagelocations, laws, and so on.

This week I ran into a nice problem that also inspired me for a new blog post.


Skype for Business and the ‘Default conferencing toll phone number’.

Within Skype for Business (Soon Microsoft Teams) you have a ‘Default conferencing toll phone number‘. This is determined by the UsageLocation in Office 365. You can also see the Location in the Skype & Teams admin center.

Skype for business conference meeting foreign number
Skype for Business conference meeting foreign number.

You can see the UsageLocation in Office 365 when you open a user and click on edit at Product Licenses. At the top the UsageLocation is indicated.

Skype for business conference meeting foreign number
Skype for Business conference meeting foreign number.
Skype for Business default toll number
Skype for Business default toll number.

When logging in, the user gets the question from where they work, and I think that the default is where headquarters is located. I can not say this with certainty though.

Skype for Business default toll number
Skype for Business default toll number.

They get the same question popped up in Exchange Online. I’m not sure which one is the UsageLocation. We have AADConnect that sets the UsageLocation automatically.

Some users click through so quickly that they do not set the Office 365 UsageLocation to their home country, and so the default toll number in Skype For business becomes the wrong number.

Reviewing this it’s not a big problem, but when creating a Skype conference meeting, the Skype conference meeting will have a foreign number instead of the default toll number of the relevant country.

Skype for business conference meeting foreign number
Skype for business conference meeting foreign number.

This is easy to change in the GUI, but what if you want to change more users at once? As you can see in the image below, the default conferencing toll phone number is a dutch number starting with +31 20..

I have written both options in a tutorial, with some creative solutions.


Change the Skype for Business Default conferencing toll phone number.

I assume in all manuals that you are a system administrator. So I do not go too far into the subject, and I will not use many screenshots this time either. If it is not clear, or if you have another question you can always leave a comment.

If you do not change this, users in a Skype conference meeting will see a foreign number. No problem, but it is not neat.


Change the Skype for Business Default conferencing toll phone number in the GUI.

Per step explained for the GUI:

  • Login on the Office 365 portal.
  • Search for the user and check if his UsageLocation is already correct by opening the user and clicking on Edit licenses.
  • Open Admin Centers in the left menu and open the Skype & teams admin center.
  • Go to Users and search for the relevant user.
  • Click on edit at Assigned Policies.
  • Change the Toll number to the correct number.
  • Click Save.

If the user now creates a new Skype conference meeting, the correct number will be shown.


Change the Skype for Business Default conferencing toll phone number with PowerShell for one user.

Before you can edit the users with PowerShell, you first need the Skype for Business PowerShell module. You can download the Skype for Business module here.

Install the module and then run this script to log in.

Import-Module SkypeOnlineConnector
$sfbSession = New-CsOnlineSession
Import-PSSession $sfbSession

To customize a specific user now you can use the following script. Change the UserPrincipalname and DefaultTollnumber to the correct one.

Set-CsOnlineDialInConferencingUser -Identity USERPRINCIPALNAME -ServiceNumber DEFAULTTOLLNUMBER

For more information about the cmdlet itself, go to Technet here.


Bulk change the Skype for Business Default conferencing toll phone number with PowerShell.

To make a bulk adjustment, you first have to retrieve the users, for example from a CSV file or from Office 365. I have done it from Office 365 so that I can pick up the right users with the incorrect UsageLocation. This piece is in the ‘A little extra to give you ideas’ part.

You can use this to customize users from a CSV file. My column name is UserPrincipalName which contains the user email addresses. Locate your csv-file and place this in the script, and change the Servicenumber.

$data = import-csv C:\CSVLOCATION.csv

foreach ($d in $data){
Set-CsOnlineDialInConferencingUser -Identity $d.userprincipalname -ServiceNumber "SERVICENUMBER"
}

A little extra to give you idea’s.

The full script that I have used retrieves from Office 365 all users who have a specific CustomAttribute1. This is US1 for me. With this I can determine who US users are, maybe you have another attribute with which you can determine this?

The script also logs in to Exchange Online and Office 365 via MFA.

You can download the Office 365 module directly, the Exchange Online version is taken from the tenant itself. I expect you to know how to do this as a system administrator.

#MFA ENABLED login O365 en EXO

param(

[parameter(Mandatory=$True)][string]$username

)

Import-Module $((Get-ChildItem -Path $($env:LOCALAPPDATA + "\Apps\2.0\") -Filter Microsoft.Exchange.Management.ExoPowershellModule.dll -Recurse ).FullName|? {$_ -notmatch "_none_"}|select -First 1)

$EXOSession = New-ExoPSSession -UserPrincipalName $username

Import-PSSession $EXOSession

Connect-MsolService

#Login Skype

Import-Module SkypeOnlineConnector

$sfbSession = New-CsOnlineSession

Import-PSSession $sfbSession

#SCRIPT

$MBx = get-mailbox -ResultSize unlimited -filter {(customattribute1 -eq "US1") -and (recipienttypedetails -eq "UserMailbox")}

$data = @()

foreach ($m in $mbx)

{

$data+=Get-msoluser-UserPrincipalName $m.primarysmtpaddress|Where-Object{$_.usagelocation-eq"NL"}|Set-MsolUser-UsageLocation US

foreach($d in $data)

{

Get-CsOnlineDialInConferencingUser-Identity $d.Identity.RawIdentity|Where-Object{$_.servicenumber-eq"Foreignnumber"}|Set-CsOnlineDialInConferencingUser-ServiceNumber "newnumber"

}

}

Recap

You may have arrived at this post because you have a foreign number in your Skype for Business conference meeting. Then it is best to forward this blog post to your helpdesk or system administrator.

If there are further questions or ambiguities about this subject, I would like to hear it. Please leave a comment.


A little extra

This post contains PowerShell. Would you like to learn the basics better? I have created a new website to learn basic PowerShell in an ’emulator’ environment.
Click here to go learn Basic PowerShell.

Published by

Bas Wijdenes

My name is Bas Wijdenes and I work full-time as a Services Engineer. In my spare time I write about the error messages that I encounter during my work. Furthermore, I am currently occupied with Office 365, Azure infrastructure, and PowerShell for automating daily tasks.

Leave a Reply

Your email address will not be published. Required fields are marked *