The possibility to manage Lync using Remote PowerShell on a distant deployment has been available since Lync 2010. This feature has always required a direct connection from the management station to the Remote Lync, and a series of steps that is not always simple to set up. Lync Online supports Remote PowerShell using a dedicated (64-bit only) PowerShell module, the Lync Online Connector. It is used to manage online users, and it is interesting because there are many settings and automation options that are available only through PowerShell.
Lync Online Connector requires one of the following operating systems: Windows 7 (with Service Pack 1), Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows 8, or Windows 8.1. At least PowerShell 3.0 is needed. To check it, we can use the $PSVersionTable
variable. The result will be like the one in the following screenshot (taken on Windows 8.1, which uses PowerShell 4.0):
$credential = Get-Credential
cmdlet in a PowerShell session. We will be prompted for our username and password for Lync Online, as shown in the following screenshot:New-CsOnlineSession
cmdlet. One of the ways to start a remote PowerShell session is $session = New-CsOnlineSession -Credential $credential
.Import-PSSession $session
cmdlet.The feature is based on a PowerShell module, the LyncOnlineConnector, shown in the following screenshot:
It contains only two cmdlets, the Set-WinRMNetworkDelayMS
and New-CsOnlineSession
cmdlets. The latter will load the required cmdlets in memory. As we have seen in the previous steps, the Online Connector adds the Lync Online PowerShell cmdlets to the ones already available. This is something we will use when talking about hybrid deployments, where we will start from the Lync Management Shell and then import the module for Lync Online. It is a good habit to verify (and close) your previous remote sessions. This can be done by selecting a specific session (using Get-PSSession
and then pointing to a specific session with the Remove-PSSession
statement) or closing all the existing ones with the Get-PSSession | Remove-PSSession
cmdlet.
There are some checks that we are able to perform when using the PowerShell module for Lync Online. By launching the New-CsOnlineSession
cmdlet with the –verbose switch, we will see all the messages related to the opening of the session. The result should be similar to the one shown in the following screenshot:
Another verification comes from the Get-Command -Module tmp_gffrkflr.ufz
command, where the module name (in this example, tmp_gffrkflr.ufz
) is the temporary module we saw during the Import-PSSession
step. The output of the command will show all the Lync Online cmdlets that we have loaded in memory.
During the introduction of this section, we also discussed the possibility to administer on-premises, remote Lync Server 2013 deployment with a remote PowerShell session. John Weber has written a great post about it in his blog Lync 2013 Remote Admin with PowerShell at http://tsoorad.blogspot.it/2013/10/lync-2013-remote-admin-with-powershell.html, which is helpful if you want to use the previously mentioned feature.
18.220.18.186