Managing Lync Online with PowerShell
While articles on this blog are primarily focused on real time communication capabilities provided throughout Lync on-premises environments, as Microsoft moves forward with including more voice and video features in their cloud offering then integration and management of Lync Online will start become more common here.
One of the first steps in this journey is understanding how a Lync Online tenant can administer their environment. Just as with a Lync on-premises deployment there are two primary tools for doing this: a web-based graphical user interface (GUI) and a command-line shell.
Since the original Lync 2010 release the GUI tool has been a Microsoft Silverlight based control panel that was also delivered as a web portal provided by IIS running on a Lync Front End server. The shell portion has leveraged Windows PowerShell by using a module of several hundred cmdlets to control every aspect of the platform.

Yet Lync Online, soon to be upgraded to Skype for Business Online, leverages a single, massive multitenant deployment of Lync 2013 thus a large portion of server-side capabilities are not exposed to the individual tenant administrators. Clearly disastrous results could occur if a single tenant had the ability to modify the behavior of any single component or parameter that could potentially impact any or all other tenants. Because of this shared model the administration tools for managing Lync Online are quite different than what administrators of on-premises deployments are used to.
First off the Lync Control Panel is replaced with the Lync Admin Center which is a component of the centralized Office 365 Admin Center. As seen below the listed sections in the admin center is a mere shadow of what is available in the control panel shown above.

As expected the available PowerShell cmdlets is also quite different between the platforms. With just a couple commands the current total of individual cmdlets in the Lync on-premises server module can be retrieved.

As of the time this article was written there are only 50 unique cmdlets available in Lync Online, which is quite the difference from the nearly 750 cmdlets provided to manage an on-premises deployment of Lync.
While connecting to the admin center is as simple as opening a web browser on any computer or device with Internet access leveraging PowerShell does require a short one-time setup for a Windows workstation.
As a prerequisite the Windows operating system on the computer to be used must be of the 64-bit variety and be running at a minimum Windows 7 or Windows Server 2008 R2. Additionally Windows PowerShell 3.0 or newer must be installed on the system. Windows 7 and Server 2008 R2 with at least Service Pack 1 will already fulfill this requirement as PowerShell 3.0 is the default version, with newer operating systems (e.g. Windows 8 and Server 2012) utilizing 4.0 and newer.
- To confirm the version of PowerShell running on the selected Windows computer open a new PowerShell session and execute the cmdlet and then take note of the PSVersion value.
- With the prerequisites covered the next step is to download and install the Windows PowerShell Module for Lync Online from the following Microsoft Download page: https://www.microsoft.com/en-us/download/details.aspx?id=39366

Once completed the installation will not create any shortcuts to a separate shell or application, but the Lync Online Connector module will be installed and ready to be imported into PowerShell.
As this new command module is not part of the inherent Windows installation and although provided and signed by Microsoft it was downloaded from the Internet, thus the default behavior of PowerShell will be to block even the computer administrator from importing the command module. To resolve this the script execution policy must be modified.
- Open a Windows PowerShell session as an administrator and then enter the following cmdlet to query the existing script execution policy configuration.
If this workstation has already been configured to use another product’s external modules then the value may already be set to something other than Restricted. If that is the case then the next step can possibly be skipped, depending on the current value.
If the default value of Restricted is set then this will need to be changed in order to import the Lync command module each time a new PowerShell instance is started.
- In the same PowerShell window enter the following Set-ExecutionPolicy cmdlet to lower the policy to a compatible level of RemoteSigned required to use the Lync Online module.
This completes the one-time setup for the workstation and these steps should not need to be performed again.
While there are already a handful of articles on this topic, including the official TechNet documentation, many of these include extraneous steps which make it a bit difficult for the first time user to understand the process. This section will cover the minimum number of basic commands required to connected, while a later section will introduce a customized script which can be used to automate these individual steps for repeated future use.
What is important to understand is that the installed command module does not contain a complete set of Lync Online cmdlets, but is instead a single cmdlet that is used to establish a remote PowerShell session to Lync Online. Each online user account which is configured as an administrator in Lync is allowed up to 3 simultaneously remote PowerShell sessions.
The individual steps listed here all include the optional parameter in the screenshots for instructional purposes and can be omitted when running each cmdlet.
- Open a Windows PowerShell session and then enter the Import-Module cmdlet to import the Lync Online command module into the active PowerShell instance.


- Enter the following command to complete the connection by importing the Lync Online cmdlets form the remote session into the local session.
These three easy steps have now provided remote PowerShell access to the connected Lync Online tenant. To test connectivity simply try running one of the supported Lync Online cmdlets, like Get-CsClientPolicy.
As previously mentioned there are only a handful of cmdlets for Lync Online so a majority of the common Lync cmdlets will not work here. How is one to know exactly which cmdlets are available to the Lync Online administrator? One option is to look at the TechNet documentation listing the Lync Online cmdlets but as that information is not always up to date another option is to query for the actual list directly from within PowerShell.
In the PowerShell instance from in the previous step notice that the output of the Import-PSSession cmdlet reports a temporary name (e.g. ) for the imported session. If that output has already been cleared or scrolled off of the buffer then the following cmdlet can be used to query for it.
- In the existing PowerShell instance run the Get-Module cmdlet to list all currently active modules. Note the name of last entry which lists a “ cmdlet format under the Exported Commands field.
- (e.g. )
As promised the following guidance can be used to create a script to start up the PowerShell session requiring nothing more than entering the administrator’s password.
- Using either a simple text editor like Notepad or a more advanced tool like Windows PowerShell ISE create a new script file (e.g. ).
- Enter the following text into this file, replacing the highlighted example user account name with the desired administrator account for the appropriate Office 365 tenant.
- Save the file and then either store it in a path that PowerShell can see by default (e.g. ) and simply invoke this script after starting a new PowerShell session.

This basic script will perform all of the required commands including prompting for the supplied account’s password, and then complete with an optional query of the tenant’s Display Name to (a) verify the remote connection is working and (b) list the connected tenant name which may come in handy if administering more than one tenant form the same workstation. The last command can be omitted if desired.
Filed under Lync, Office 365 · Tagged with Admin
About Jeff SchertzSite Administrator