To connect to Exchange Online in Office 365 open a PowerShell prompt and simply run the following commands:

if ($cred -eq $null)
{
	$cred = Get-Credential
}

Write-Host "Connecting to Exchange Online"

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

Import-PSSession $exchangeSession | Out-Null

Write-Host "Connected to Exchange Online"

Find this script also on Git

Advertisements