How To Connect to Exchange Online Using PowerShell (March 2018)

In this blog post, I’ll show you how to connect to Microsoft Exchange Online using PowerShell using 4 cmdlets.


The requirements are very basic, you will need a Windows 7 with SP1 and above computer with Microsoft .NET 4.5 and later Installed.

If you are using Windows 10 or Windows Server 2016 you don’t need to install anything.

To connect, I’ll use the cmdlets below:

First, Start PowerShell as Administrator (I’m using PowerShell ISE) and I’ll use the first cmdlet to set the execution policy to remote sign.

Note: This step Is only needed once, If it set to unsigned you can skip this step

Set-ExecutionPolicy RemoteSigned

Next, I’ll enter my Exchange Online Administrator Username and Password:

$UserCredential = Get-Credential

Next, I’ll open a PowerShell remote session to Exchange Online

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $UserCredential -Authentication Basic -AllowRedirection

Next, I’ll Import the Remote PowerShell session

Import-PSSession $Session

Done, Now I’m connected and can run any Exchange Server cmdlet

To close the remote session use the cmdlet below:

Remove-PSSession $Session