Connect to Office 365 with Powershell

#en, #office365 edit this page

In this Post I explain how to connect to Office 365 with Powershell and manage Exchange and Lync.

1. Install Microsoft Online Services Sign-In Assistant for IT Professionals BETA
http://www.microsoft.com/en-us/download/details.aspx?id=39267

2. Install the Office 365 cmdlets
http://go.microsoft.com/fwlink/p/?linkid=236297

3. Set Execution Policy to Remote Signed
Set-ExecutionPolicy RemoteSigned

Exchange Online

4. Connect to Exchange Online

Import-Module MSOnline
$ExchangeOnlineCred = Get-Credential
$ExchangeOnlineSession = New-PSSession –ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $ExchangeOnlineCred -Authentication Basic -AllowRedirection
Import-PSSession $ExchangeOnlineSession -AllowClobber
Connect-MsolService –Credential $ExchangeOnlineCred

Now you are connected to Exchange Online:

image


Lync Online

4. Install Windows PowerShell Module for Lync Online
http://www.microsoft.com/en-us/download/details.aspx?id=39366

5. Connect to Lync Online

Import-module lynconlineconnector
$LyncOnlineCred = Get-Credential
$LyncOnlineSession = New-CsOnlineSession -Credential $LyncOnlineCred
Import-PSSession $LyncOnlineSession

image

Greetings
dn