Recently I faced the problem when connecting to Lync Online (Office365) received one of the following errors:
“The ‘New-CsOnlineSession’ command was found in the module ‘LyncOnlineConnector’, but
the module could not be loaded. For more information, run ‘Import-Module LyncOnlineConnector’”
“Unable to discover PowerShell endpoing URI At C:\Program Files\Common Files\Microsoft Lync Server 2013\Modules\LyncOnlineConnector\LyncOnlineConnectorStartup.psm1”
First of all ensure you have downloaded and installed the Powershell Module for Lync Online
Next, and this is the weird part set the powershell execution policy to “unrestricted”, is seems there is an issue with the modules loading, we were able to discover this by comparing a powershell session for one system that worked and other that did not.
The specific command is Set-ExecutionPolicy unrestricted
And the last error ensure we have configured your Lyncdiscover records in your External DNS, this is needed for powershell to detect and connect to online Lync environment, if you are in a hybrid configuration you may be pointing this to On-Premises Lync and not Lync online. You can find your specific configuration by clicking on your domain in the office 365 admin center.
Finally the syntax to connect to your Lync Online is:
$LiveCred = Get-Credential
$LyncSession = New-CsOnlineSession -Credential $livecred