Saturday, September 5, 2015

[O365] Connect to Office 365





Step 1: Start Windows PowerShell as an administrator

Get-ExecutionPolicy
Set-ExecutionPolicy RemoteSigned

Step 2: Create a Windows PowerShell credentials object

$credential = Get-Credential

Step 3: Connect to Office 365

Import-Module MsOnline
Connect-MsolService -Credential $credential

Step 4: Connect to Exchange Online

$exchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid/" -Credential $credential -Authentication "Basic" -AllowRedirection

Import-PSSession $exchangeSession

Obs: IF SSL ERROR

$proxysettings = New-PSSessionOption -ProxyAccessType IEConfig

$exchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid/" -Credential $credential -Authentication "Basic" -AllowRedirection -SessionOption $proxysettings


Step 5: Connect to SharePoint Online

Import-Module Microsoft.Online.SharePoint.PowerShell
Connect-SPOService -Url https://litwareinc-admin.sharepoint.com -credential $credential


Step 6: Connect to Lync Online

Import-Module LyncOnlineConnector
$lyncSession = New-CsOnlineSession -Credential $credential
Import-PSSession $lyncSession