Step 5: Connect to Lync Online


Connecting to Lync Online (and to Exchange Online) isn’t very hard, but it is a tiny bit trickier than connecting to Office 365 or to SharePoint Online. That’s because the Lync and Exchange cmdlets don’t get installed on your computer like the Office 365 and the SharePoint cmdlets do. Instead, each time you log on the appropriate cmdlets are temporarily copied to your computer. When you log off, those cmdlets are then removed from your computer.

In order to connect to Lync Online you must import the Lync module. To do that, run this command:

Import-Module LyncOnlineConnector

And then, after the module has been imported, run this command:

$lyncSession = New-CsOnlineSession -Credential $credential

When the command completes, you will see something similar to this onscreen:

Id Name       ComputerName    State  ConfigurationName    Availability
-- ----       ------------    -----  -----------------    ------------
1  Session1 Opened Microsoft.PowerShell Available

What’s going on here? Well, what’s going on here is that we’ve created a remote PowerShell session. In this case, that means that we’ve connected to an instance of Windows PowerShell running on one of the Office 365 servers. However, just creating that session does very little for us. For example, try running this Lync Online command:


That command is going to fail, and you’ll get the following error message:

Get-CsMeetingConfiguration : The term 'Get-CsMeetingConfiguration' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Why did the call to Get-CsMeetingConfiguration fail? That’s easy: because the Get-CsMeetingConfiguration cmdlet doesn’t exist anywhere on your computer. Although we’ve made a connection to Office 365, we haven’t downloaded the scripts, cmdlets, and other items needed to manage Lync Online. To do that, we have to run this command:

Import-PSSession $lyncSession

When you import the Windows PowerShell session, you should see a progress bar similar to the following, a progress bar that reports on all the Lync Online management items being imported to your computer:

Lync Online progress bar.

When the progress bar disappears, you should then see output similar to the following:

ModuleType Version    Name               ExportedCommands
---------- -------    ----               ----------------
Script     1.0        tmp_swc5mp4v.1ck  {Copy-CsVoicePolicy, Disabl...

Now try running Get-CsMeetingConfiguration and see what happens. You should get back something similar to this:

Identity                        : Global
PstnCallersBypassLobby          : True
EnableAssignedConferenceType    : False
DesignateAsPresenter            : Company
AssignedConferenceTypeByDefault : True
AdmitAnonymousUsersByDefault    : True
RequireRoomSystemsAuthorization : False
LogoURL                         :
LegalURL                        :
HelpURL                         :
CustomFooterText                :
AllowConferenceRecording        : True

That’s more like it. All that’s left now is to get Exchange added to our Windows PowerShell session.

Step 6: Connect to Exchange Online

See Also

Connect to Office 365 by using a single Windows PowerShell window