Behind the Scenes look at the Skype for Business Online PowerShell Module

As Skype for Business Online (SfBO) adoption on Office 365 continues to grow, more organizations are turning to PowerShell to manage the SfBO tenant and users.

The Skype for Business PowerShell Module used to the connect to the tenant is interesting.  Knowing a little but about how this module works behind the scene’s can go a long way to understanding any issues that come up.

There are 3 things you need to do to connect to your Skype for Business Online tenant with PowerShell using the SfBO PowerShell Module:

Action PowerShell to Accomplish It Notes
Import the SkypeOnlineConnector Import-Module -Name SkypeOnlineConnector  
Establish a New Remote SfBO PowerShell Session $SFBOSession = New-CSOnlineSession -credential $Credential  $Credential holds the SfBO admin credentials to the tenant
Import the remote session into your local PowerShell session Import-PSSession $SFBOSession –AllowClobber The –AllowClobber parameter will allow us to redefine any existing cmdlet’s with the same name in our local PowerShell session.

This blog entry details what each of these 3 steps are doing behind the scene’s.


Import the SkypeOnlineConnector

This Import-Module cmdlet makes the SkypeOnlineConnector module available in the local PowerShell session (e.g. in the console or ISE).

The module is usually installed locally here:

C:\Program Files\Common Files\Skype for Business Online\Modules\SkypeOnlineConnector

The interesting thing is this, unlike many other Microsoft modules, it is script module – meaning the whole module is defined in a PowerShell script that you can read for yourself.  It is located in this PowerShell file:


When we open this script, we see the following 2 PowerShell function definitions which define the cmdlet’s which allow us to establish the remote PowerShell session, and import the cmdlet’s:

  1. New-CsOnlineSession
  2. Set-WinRMNetworkDelayMS


Establish a New Remote SfBO PowerShell Session

Next, let’s look at what these two cmdlet’s do exactly:

$Credential = Get-Credential

$SFBOSession = New-CSOnlineSession -credential $Credential

As we noted above, the New-CsOnlineSession is a function defined in the PowerShell module. The function description inside the script describes perfectly what it does:

Creates a remote session to Microsoft Lync Online DataCenter. In this session, tenant administrator can run Lync cmdlets to manage users, policies and configurations.


If this completes successfully, the variable $SFBOSession now holds a remote Powershell session to the SfBO tenant. Looking at the properties of this online session reveals the online server the remote session is established with:

$SFBOSession | select *



ComputerName           :


NOTE: for SfB Hybrid Deployments

In SfB deployments that are hybrid, the DNS records used by remote PowerShell generally point on-premises, so you need to specify an –Override parameter to override the DNS name with the intial domain name of the Office 365 tenant (e.g. <domain>

This issue is documented well here:


Import the Remote Session into your Local PowerShell Session

Finally the Import-PSSession cmdlet will import the cmdlets, functions, aliases in the remote PowerShell session into the current local sessions so that we can work use them.


You’ll notice that this Import-PSSession cmdlet returns a temporary PowerShell module. This module holds the cmdlet’s that were imported from the remote session (it actually does not hold the cmdlet’s themselves but rather proxy definitions).

There are 2 important things to realize here:

1. The Skype for Business Online cmdlet’s are not defined in the Skype for Business Online PowerShell module. This means that the cmdlet’s made available could vary by tenant, and be changed by Microsoft without releasing a new PowerShell module (to install locally). The takeaway for IT organizations is that changes can (and do happen). It doesn’t happen often, and changes are usually well advertised in advance and are usually cmdlet additions; but there have been (and will be) changes to the online cmdlet’s. 

This temporary PowerShell module get be seen with the Get-Module cmdlet, and like the SfBO PowerShell Module itself is a script module, so we can see all the definitions of the cmdlets it makes available.  It is available in the C:\Users\<user>\AppData\Local\Temp\ directory.

2. All the online cmdlet definitions reside in this module.  You can see them by using the Get-Command cmdlet as follows:

Get-Command –Module “tmp_chdu42yi.nev”| Sort-Object Name

As of March 2017, there are about 178 cmdlet’s in an Office 365 E3 SfBO tenant with no Add-On plans.


More Information

Skype for Business Online, Windows PowerShell Module

Using Windows PowerShell to manage Skype for Business Online


Diagnosing and resolving connection problems with Skype for Business Online

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>