Connecting to Office 365(Exchange Online) via Powershell

  • Open Powershell as administrator
  • Run command – Set-ExecutionPolicy Remotesigned
  • Type Y for yes
  • Run command – $UserCredential = Get-Credential
  • Sign in with O365 administrator account (user@company.com)
  • Run command – $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUrl https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
  • Run command – Import-PSSession $Session
  • You are now connected to O365 Exchange Online