Download and use the Exchange Online PowerShell V3 module with modern authentication
How to Download and Use the Exchange Online PowerShell Module
If you are an administrator who needs to manage Exchange Online in Microsoft 365, you might want to use PowerShell to perform various tasks. However, connecting to Exchange Online PowerShell can be challenging, especially if you have multi-factor authentication (MFA) enabled. Fortunately, there is a solution that can make your life easier: the Exchange Online PowerShell module.
What is the Exchange Online PowerShell Module?
The Exchange Online PowerShell module is a tool that uses modern authentication and works with MFA for connecting to all Exchange-related PowerShell environments in Microsoft 365. These environments include:
download exchange online powershell module
Exchange Online PowerShell
Security & Compliance PowerShell
Standalone Exchange Online Protection (EOP) PowerShell
The module also provides optimized cmdlets that are backed by the REST API, which offer better security, reliability, and performance than the traditional remote PowerShell cmdlets.
The Benefits of the Exchange Online PowerShell Module
Some of the benefits of using the Exchange Online PowerShell module are:
You can connect to Exchange Online PowerShell with or without MFA using a single command.
You can access all the cmdlets and parameters that you need for managing Exchange Online.
You can use REST API cmdlets that have built-in support for modern authentication and don't rely on Basic authentication in WinRM.
You can handle transient failures with built-in retries, so failures or delays are minimized.
You can avoid setting up a PowerShell runspace in Exchange Online, which can improve the connection speed.
The Differences Between the EXO V2 and EXO V3 Modules
The Exchange Online PowerShell module has two versions:
Version 2.0.5 and earlier is known as the EXO V2 module.
Version 3.0.0 and later is known as the EXO V3 module.
The EXO V3 module improves upon the capabilities of the EXO V2 module with some new features, such as:
Certificate based authentication (CBA) or app-only authentication for Security & Compliance PowerShell.
All cmdlets backed by the REST API in Exchange Online PowerShell.
Support for C# to connect to Exchange Online PowerShell.
How to Install the Exchange Online PowerShell Module
Prerequisites for Installing the Module
Before you install the module, you need to meet some requirements, such as:
You need to have Windows 10 or later on your computer.
You need to have Windows PowerShell 5.1 or later on your computer.
You need to have an administrator account in Microsoft 365 that has permissions to manage Exchange Online.
You need to have an internet connection on your computer.
Steps for Installing the Module
To install the module, you need to follow these steps:
Open a Windows PowerShell window as an administrator.
Run the following command to install the module from the PowerShell Gallery:Install-Module -Name ExchangeOnlineManagement - If you are prompted to trust the repository, type Y and press Enter.
Run the following command to import the module into your PowerShell session:Import-Module -Name ExchangeOnlineManagement
Run the following command to check the version of the module that you installed:Get-Module -Name ExchangeOnlineManagement
If you have an older version of the module, you can update it by running the following command:Update-Module -Name ExchangeOnlineManagement
How to Connect to Exchange Online PowerShell Using the Module
Connecting with or Without Multi-Factor Authentication (MFA)
To connect to Exchange Online PowerShell using the module, you need to run the following command:Connect-ExchangeOnline -UserPrincipalName
Replace with your user principal name (UPN), which is usually your email address. For example:Connect-ExchangeOnline -UserPrincipalName admin@contoso.com
How to install and use the Exchange Online PowerShell V3 module
Connect to Exchange Online PowerShell with modern authentication and MFA
Exchange Online PowerShell V3 module features and benefits
Troubleshoot Exchange Online PowerShell V3 module connection issues
Update or uninstall the Exchange Online PowerShell V3 module
Use REST API cmdlets in the Exchange Online PowerShell V3 module
Certificate based authentication for Exchange Online PowerShell V3 module
Use C# to connect to Exchange Online PowerShell V3 module
App-only authentication for unattended scripts in Exchange Online PowerShell
Use Azure managed identities to connect to Exchange Online PowerShell
Find the permissions required to run Exchange Online PowerShell cmdlets
Import and export data using the Exchange Online PowerShell V3 module
Manage mailboxes and recipients with the Exchange Online PowerShell V3 module
Configure transport rules and policies with the Exchange Online PowerShell V3 module
Monitor and audit Exchange Online activity with the Exchange Online PowerShell V3 module
Automate tasks and workflows with the Exchange Online PowerShell V3 module
Run reports and analytics with the Exchange Online PowerShell V3 module
Manage hybrid deployments with the Exchange Online PowerShell V3 module
Secure your Exchange Online environment with the Exchange Online PowerShell V3 module
Optimize performance and reliability with the Exchange Online PowerShell V3 module
Compare old and new connection methods for Exchange Online PowerShell
Learn about role-based access control in Exchange Online PowerShell
Use remote sessions and implicit remoting in Exchange Online PowerShell
Manage public folders and groups with the Exchange Online PowerShell V3 module
Manage retention and compliance with the Exchange Online PowerShell V3 module
Manage mobile devices and applications with the Exchange Online PowerShell V3 module
Manage calendar and mailbox permissions with the Exchange Online PowerShell V3 module
Manage mail flow and connectors with the Exchange Online PowerShell V3 module
Manage anti-spam and anti-malware settings with the Exchange Online PowerShell V3 module
Manage encryption and certificates with the Exchange Online PowerShell V3 module
Manage address lists and email address policies with the Exchange Online PowerShell V3 module
Manage mailbox migrations and moves with the Exchange Online PowerShell V3 module
Manage shared mailboxes and resources with the Exchange Online PowerShell V3 module
Manage distribution lists and contacts with the Exchange Online PowerShell V3 module
Manage litigation hold and eDiscovery with the Exchange Online PowerShell V3 module
Manage archiving and retention policies with the Exchange Online PowerShell V3 module
Manage mailbox backup and recovery with the Exchange Online PowerShell V3 module
Manage mailbox quotas and limits with the Exchange Online PowerShell V3 module
Manage mailbox auditing and logging with the Exchange Online PowerShell V3 module
Manage mailbox rules and alerts with the Exchange Online PowerShell V3 module
If you have MFA enabled, you will be prompted to enter your password and then verify your identity using a phone call, text message, or app notification. If you don't have MFA enabled, you will only be prompted to enter your password.
After you successfully authenticate, you will see a message that says "Welcome to Exchange Online PowerShell". You can then start running cmdlets to manage Exchange Online.
Connecting to Different PowerShell Environments in Microsoft 365
The Connect-ExchangeOnline cmdlet allows you to connect to different PowerShell environments in Microsoft 365 by using the -ConnectionUri parameter. The following table shows some examples of the values that you can use for this parameter:
PowerShell Environment ConnectionUri Value --- --- Exchange Online PowerShell Security & Compliance PowerShell Standalone EOP PowerShell For example, to connect to Security & Compliance PowerShell, you can run the following command:Connect-ExchangeOnline -UserPrincipalName admin@contoso.com -ConnectionUri
Disconnecting from Exchange Online PowerShell
To disconnect from Exchange Online PowerShell, you can run the following command:Disconnect-ExchangeOnline
This will close the connection and remove the session from your computer. You will see a message that says "Disconnected from Exchange Online PowerShell".
How to Use the Exchange Online PowerShell Module
Using REST API Cmdlets in Exchange Online PowerShell
The Exchange Online PowerShell module provides REST API cmdlets that are prefixed with EXO. These cmdlets use modern authentication and are faster and more reliable than the remote PowerShell cmdlets. They also support more parameters and features than the remote PowerShell cmdlets.
To use the REST API cmdlets, you need to connect to Exchange Online PowerShell using the module. Then, you can run any cmdlet that starts with EXO. For example, to get a list of all mailboxes in your organization, you can run the following command:Get-EXOMailbox
You can also use filters, properties, and other parameters with the REST API cmdlets. For example, to get a list of all mailboxes that have a quota of more than 10 GB, you can run the fo