Connect PowerShell to Exchange Online (Office 365)

Windows PowerShell

Following instructions will help to connect Windows PowerShell to your Microsoft Exchange Online or Office 365 service.

  1. Run Windows Power Shell as Administrator
  2. Run Set-ExecutionPolicy Unrestricted
  3. Run $LiveCred = Get-Credential
  4. Provide your Office 365 administrator account credentials
  5. Run $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $LiveCred -Authentication Basic -AllowRedirection
  6. Run Import-PSSession $Session

You should now be connected to your Office 365 account. To test connection you can run Get-Mailbox which should list all mailboxes in your Hosted Exchange account.

To disconnect from the service run: Remove-PSSession $Session



Subscribe to receive occasional updates on new posts.
Your email will not be used for any other purpose and you can unsubscribe at any time.
Please wait