Connect Office 365 Exchange Online to PowerShell

September 12, 2019 By Admin

The Exchange Online allows management of the Office 365 via PowerShell Command Lines. And while you are doing some activity in Office 365 through the PowerShell, you need to establish the connection between Exchange Online and PowerShell.

Step by Step Process for Connecting Office 365 to PowerShell

Step 1: First search the Windows PowerShell and right-click on it then select the Run as Administrator.

Step 2: Once it opens you need you to type the command lines to connect Exchange Online PowerShell.

Note: After execution, you have to log in your Office 365 Admin Account details like ID and Password.

$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $O365cred -Authentication Basic -AllowRedirection

Step 3: Once you logged in your Office 365 account you have successfully connected the Exchange Online Windows PowerShell.

Special Connection URIs for Different Regions

Note: If it comes under some specific operator then you have to enter the following connecting URI according to you.

1- For 21Vianet Operator Users

URI: https://partner.outlook.cn/PowerShell

2- Germany Users

URI: https://outlook.office.de/powershell-liveid/

3- Under the Proxy Server Users

$proxyOptions = New-PSSessionOption –ProxyAccessType <Value>

After the end of the session, you need to enter the parameters and the values:

$Session =…command: -SessionOption $ProxyOptions

Note: The ProxyAccesstype Value: IEConfig, WinHttpConfig or AutoDetect.

Create the PSSession

Step 4: Now create the PSSession by putting the script for handling the Office 365 Account via Windows PowerShell.

Import-PSSession $Session -DisableNameChecking

Final Verdict: In this post, I tried to explain that how to connect Office 365 Exchange Online Mailbox to Windows PowerShell. I hope this blog will help to establish a connection between o365 Exchange Online and PowerShell.

100% Safe & SECURE
Lifetime Support 24/7
Money Back Guarantee
Trusted by 1000+ Customers