How to establish PowerShell connection into Office 365 Exchange

Date : March 4, 2017

We all know how important PowerShell has become, so it important to be able to establish a connection to Office 365.

Some things just can’t be done through the web-based GUI that Microsoft provides (or take a lot longer to do. Think repetitive tasks).

 

The 3 commands you will need to connect are:

 

$cred=Get-Credential
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://ps.outlook.com/powershell/" -Credential $cred -Authentication Basic -AllowRedirection
Import-PSSession $Session

 

Enter these one at a time, and you’ll then be connected to Office 365 Exchange!

 

You can verify the connection with the very simple command to show you a list of all your users:

Get-Mailbox

 

Happy PowerShell-ing!

Leave a Reply

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

@