Manage MS Teams Call-forwarding in Powershell

Yes, this is finally possible – with the MicrosoftTeams 3.0.1 preview Powershell module came a set of super handy new cmd-lets for controlling Call forwarding for all users, and also for control og delegates and local Call groups.

To get this to work you need to forcefully install the previews Powershell module

Do that by running these to commands in Powershell (Note you need minimum of Powershell v 5.1 for this locally)

Install-Module -Name MicrosoftTeams -AllowPrerelease -force
Import-Module MicrosoftTeams -force

This gives a handfull of new cmd-lets.

In this article i will highlight to control of Calling Settings – meaning forwarding, simultaneous and unaswered call settings.
(Note- there is no “remove-csusercallingsettings”, the set command is used for this with setting -isforwardingenabled)

FLOW of Set-CsUserCallingSettings

To better understand how this cmd-let works i created a drawing . Imagine the flow through the parameters and settings, when you create the wanted setting for a user.

The Legend shows:

Green box is Boolean values, so either $True og $False
Yellow selections are Parameters
Purple squares are Values for the forwarding method
Blue boxes are Values for type of forwardingtarget
Lastly the Polygon is a Stringvalue representing the target itself.

So lets create a couple of examples:

Lets say i want the user to have ALL calls forwarded to user
So i put in
Set-CsUserCallingSettings -Identity -IsForwardingEnabled $true -ForwardingType immediate -ForwardingTargetType singleTarget -ForwardingTarget “”

And my client immediately reflects this:

Lets say i want the user to have ALL calls ringing simultaneously on his mobile

So i put in:
Set-CsUserCallingSettings -Identity -IsForwardingEnabled $true -ForwardingType simultaneous -ForwardingTargetType singleTarget -ForwardingTarget “+45xxxxxxxx”
And my client immediately reflects this:

FLOW for Unanswered calls

When you want to control actions for unanswered calls, its the same cmd-let, but behaviour and parameters are different. So here is the flow:

Lets say i want the user to have ALL unanswered calls going to voicemail

So i put in:
Set-CsUserCallingSettings -Identity -IsUnansweredEnabled $true -UnansweredDelay 00:00:30 -UnansweredTargetType Voicemail
OR maybe instead have unaswered Calls go to the Reception or maybe an Auto Attendant:
You can find the name/adress for the AA inside Azure AD if in doubt, in my case its rather long.

Set-CsUserCallingSettings -Identity -IsUnansweredEnabled $true -UnansweredDelay 00:00:30 -UnansweredTargetType singleTarget -UnansweredTarget “”

And this is again immediately reflected in the client.

For both the flow for Unanswered and Forwarding there is a couple of caveats worth noting:

If using MyDelegates, these need to be defined FIRST, for it to work
If using “group” setting, you need to define the group in Powershell first – I will do an example for that below.
The setting “VoiceMail” is not available of you set “forwardingtype to Immediate.

Example for controlling forwarding to a group of people:

$mygroup = @(“”)
Set-CsUserCallingSettings -Identity -CallGroupOrder InOrder -CallGroupTargets $mygroup
Set-CsUserCallingSettings -Identity -IsForwardingEnabled $true -ForwardingType Immediate -ForwardingTargetType Group

Run the above in sequence.

Lets have a look in the client, note 2 thing happened, a local Call group was created in this case with one single member, and that group was then selected as target for Forwards.

On the Technet article documenting the cmd-let there are even more advanced scenarios, where you control, the Call Group, the change of an existing Call group, and even the notification settings

$ucs = Get-CsUserCallingSettings -Identity $cgt = {$ucs.CallGroupTargets}.Invoke() $cgt.Add(“”) $cgt.Remove(“”)
Set-CsUserCallingSettings -Identity -CallGroupOrder $ucs.CallGroupOrder -CallGroupTargets $cgt $gmd = (Get-CsUserCallingSettings -Identity $gmd[[array]::IndexOf($gmd.CallGroupOwnerId,’’)].NotificationSetting = ‘Banner’
Set-CsUserCallingSettings -Identity -GroupMembershipDetails $gmd

This example shows how to update the call group of to add and remove In addition the notification setting for for’s call group is set to Banner.

The key to note here is the call group membership is defined on the object of the owner of the call group, in the above case this is However the notification setting for a member for a particular call group is defined on the member. In this case (Source

So the use cases for theese new commands are many, and the ability alone to control this remotely and in bulk for users is a GREAT addition.

Have a great day.

Leave a Reply

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