In this article, you will learn how to connect to the Exchange PowerShell environment in Microsoft 365.
To require all PowerShell script that you download from the internet are signed by a trusted publisher, always run "Set-ExecutionPolicy RemoteSigned" from "Run as administrator" from PowerShell. This helps to prevent the execution of the malicious script.
Set-ExecutionPolicy RemoteSigned
The Exchange Online PowerShell V2 module provides access to Exchange online using modern authentication and it works with MFA enabled accounts. If you already install EXO V2 PowerShell module, then you skip the installation part. To install the EXO V2 module for the first time, run the following command in an elevated PowerShell
Install-Module -Name ExchangeOnlineManagement
To install a specific version, use below command
PS C:\Users\Administrator.EXAMPORTAL> Install-Module -Name ExchangeOnlineManagement -RequiredVersion 2.0.3
Import installed module
PS C:\Users\Administrator.EXAMPORTAL> Import-Module ExchangeOnlineManagement
Run connect to ExchangeOnline command. Enter your credentials and complete MFA authentication.
PS C:\Users\Administrator.EXAMPORTAL> Connect-ExchangeOnline -UserPrincipalName niyasadm@examportal.live -ShowProgress $true
Comments