Connect to O365 Exchange Shell

On Windows servers running Exchange, the Exchange Management Shell is nice to have for configuration tasks. What if you’ve migrated to Office 365 and don’t have on-premises Exchange anymore? Just do the following, with administrative rights.

  • Set-ExecutionPolicy RemoteSigned
  • $UserCredential = Get-Credential
  • $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
  • Import-PSSession $Session -DisableNameChecking

And when you’re finished, be sure and disconnect gracefully from O365: Remove-PSSession $Session

Leave a Reply

Your email address will not be published. Required fields are marked *