How to connect to Office 365 Exchange with PowerShell! If you need to run Exchange commands for Office 365 follow this tutorial as the first step to connecting.
The Commands Are:
Set-ExecutionPolicy RemoteSigned
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powersh... -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
To disconnect just run: Remove-PSSession $Session