MarkC on UC Microsoft Skype for Business, Lync, Exchange & Everything Else

Connecting to Office365 Lync with PowerShell

You can now access Office365/Lync management using PowerShell - here’s how.

====
You can now connect to Office365/Lync with PowerShell - this is useful as it opens up some options that are not readily available with the normal management portal.

So, let’s have a look at how. You can see the full break-down of the whole thing here:

Using Windows PowerShell to Manage Lync Online

You have to be running at least PowerShell 3.0 (If you’re on Windows 8, you’ve already got it - on Windows 8.1? You have PowerShell 4.0), and you have to have the Online Services Sign-On Assistant installed. You can get that here:

Microsoft Online Services Sign-In Assistant for IT Professionals RTW

Once that’s installed, you’ll need to download and install the PowerShell Module for Lync Online - you can get that here:

Windows PowerShell Module for Lync Online

Once they’re installed, we can now connect to Lync Online. Let’s run through how to do that - firstly, power up PowerShell.

Import the Lync Online PowerShell Module
First thing to do, is to import the PowerShell module. Easy to do, use this command:

import-module LyncOnlineconnector

You should see the result like this:

ImportModule

Add Credentials to a Variable
Next, we’re going to get our Office365 credentials and store them in a variable. To do that, use this command:

$credential=get-credential

You’ll get a windows credential box pop-up like this:

Credentials

Just be aware the credentials are
not checked at this point...Get them wrong, and it’ll not work.

Create Online Session
Next, we’re going to create the Lync Online session using the previously saved credentials - to do this, use this command:

$session=new-csonlinesession -Credential $credential

Note that sometimes this seems to take a couple of minutes to run - output should look like this:

NewSession

Import the Created Session
Finally, we’re going to import the session above ($session). To do this, enter this command:

import-pssession $session

The output should be something like this - note it can take a few minutes:

ImportSession

You’re Ready to Go!
Ok, now you’re connected, and you can manage your Lync environment within Office365. Easy hey? Have a
look here for all the supported cmdlets.

Video below shows how easy it is:








blog comments powered by Disqus