Hi Everyone this is Prem, I have worked as Microsoft 365 support ambassador. In this blog I will share how to connect with Exchange online using PowerShell in Office 365.
To connect to Exchange Online using Windows PowerShell, we will first have to make sure the necessary module is installed on the PowerShell.
ExchangeOnlineManagement is the Module which is required, it stores all the commands of Exchange Online to be able to run on PowerShell.
If you have already installed ExchangeOnlineManagement module, then you can directly run the Connect-ExchangeOnline command in the PowerShell to Connect to Exchange Online.
Irrespective of whether you have it installed or not, you can follow all the steps shown to successfully connect to Exchange Online.
If script running is disabled on you computer then we can enable it on user account level, that will allow us to Install and connect to Exchange Online.
Steps to connect to Exchange online using PowerShell:
Search for windows PowerShell on your computer locally, and run it As an Administrator:
Once opened it should look like this:
Now connect to Exchange online using the PowerShell which is opened, run the following command:
Set-ExecutionPolicy RemoteSigned -Scope Currentuser
Allow it to set the execution policy if prompted by entering A. Then run:
Install-Module -Name ExchangeOnlineManagement -Scope CurrentUser
Allow permission to install it by entering Y. After that run:
Import-Module -Name ExchangeOnlineManagement
After that run:
Enter your Global or Exchange Admin email address and password and it should get connected to Exchange Online on the PowerShell:
If you have Multifactor Authentication enabled on the account then you will have to complete the second steps of Authentication (Text, Call, Authenticator app, etc.) as well and after it is completed you should be connected to Exchange Online using PowerShell.
By following the above steps you should be able to connect to exchange online using PowerShell.
Once you are connected you should be able to Run Exchange online Commands in the Powershell, for Example:
Tags: How to connect to Exchange Online using PowerShell in Office 365