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:
1 |
$cred=Get-Credential |
1 |
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://ps.outlook.com/powershell/" -Credential $cred -Authentication Basic -AllowRedirection |
1 |
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:
1 |
Get-Mailbox |
Happy PowerShell-ing!