Skip to content

Install Exchange Online PowerShell module

How to install Exchange Online PowerShell V3 and connect to Exchange Online? A migration is planned for next week. The mailboxes are going to be migrated from on-premises to Exchange Online. We are going to install the new EXO PowerShell V3 module and use it for migrating. I recommend migrating mailboxes with PowerShell instead of the Exchange Admin Center. In this article, you will learn how to install Exchange Online PowerShell V3 module.

Exchange Online PowerShell module

The Exchange Online PowerShell module (abbreviated as the EXO V3 module) enables admins to connect to their Exchange Online environment in Microsoft 365 to retrieve data, create new objects, update existing objects, remove objects as well as configure Exchange Online and its features.

The Exchange Online PowerShell V3 module is currently in General Availability (GA). It is stable and ready for use in production environments. This started from version 1.0.1. If you have an older version running, update the EXO V3 module.

Some key points about EXO V3 module:

  • Download from PowerShell gallery
  • Run the module from Windows PowerShell and Windows PowerShell ISE
  • Single cmdlet Connect-ExchangeOnline supports both MFA and non-MFA accounts
  • EXO V3 cmdlets are REST API-based which are much faster and more reliable
  • EXO V3 uses Modern Authentication
  • Older cmdlets are backward compatible

Keep up to date and have a look at the Microsoft website for the release notes.

Install Exchange Online PowerShell V3 module

To install Exchange Online PowerShell V3 module on your system, go through the below steps.

1. Set Windows PowerShell Execution Policy

By default, we can’t install scripts. To require all PowerShell scripts that you download from the internet are signed by a trusted publisher, run PowerShell as administrator, and run the cmdlet.

Set-ExecutionPolicy RemoteSigned

Important: Close and re-open the elevated Windows PowerShell window to have the changes apply.

2. Install PowerShellGet module

Run PowerShell as administrator. Run the command Install-Module PowershellGet -Force. When asked to install NuGet provider, press Y and follow with Enter.

Install-Module PowershellGet -Force

If you get an error that it’s unable to install, read the article Unable to install NuGet provider for PowerShell.

3. Install Exchange Online Management module

Install the Exchange Online Management module.

Install-Module -Name ExchangeOnlineManagement -Force

Connect to Exchange Online PowerShell V3

Connect to Exchange Online PowerShell using the EXO V3 module with or without MFA.

Note: We recommend to enable MFA (Multi-Factor Authentication) on the accounts.

Connect with your admin account to Exchange Online. Run the Connect-ExchangeOnline cmdlet.

Connect-ExchangeOnline -UserPrincipalName admin@exoip.com

In the sign-in window that opens, enter your password, and then click Sign in.

Install Exchange Online PowerShell V2 sign in

If MFA is enabled, a verification code is generated and delivered based on the verification response option configured for your account. For example, a text message or the Microsoft Authenticator app on your mobile phone.

Install Exchange Online PowerShell V2 MFA

After the verification succeeds, you will return to the PowerShell window, and the below text will appear in a banner.

----------------------------------------------------------------------------------------
This V3 EXO PowerShell module contains new REST API backed Exchange Online cmdlets which doesn't require WinRM for Client-Server 
communication. You can now run these cmdlets after turning off WinRM Basic Auth in your client machine thus making it more secure.

Unlike the EXO* prefixed cmdlets, the cmdlets in this module support full functional parity with the RPS (V1) cmdlets.

V3 cmdlets in the downloaded module are resilient to transient failures, handling retries and throttling errors inherently.

However, REST backed EOP and SCC cmdlets are not available yet. To use those, you will need to enable WinRM Basic Auth.

For more information check https://aka.ms/exov3-module
----------------------------------------------------------------------------------------

PS C:\>

If you don’t want to show the screen output when connecting to Exchange Online, use the -ShowBanner switch. This will hide the banner, as seen above.

Connect-ExchangeOnline -UserPrincipalName admin@exoip.com -ShowBanner:$false

Now we are connected to Exchange Online PowerShell and ready to type in the new cmdlets.

Exchange Online PowerShell V3 new cmdlets

See the list of new and old cmdlets.

New cmdlet in the EXO V3 moduleOlder related cmdlet
Get-EXOMailbox Get-Mailbox
Get-EXORecipient Get-Recipient
Get-EXOCASMailbox Get-CASMailbox
Get-EXOMailboxPermission Get-MailboxPermission
Get-EXORecipientPermission Get-RecipientPermission
Get-EXOMailboxStatistics Get-MailboxStatistics
Get-EXOMailboxFolderStatistics Get-MailboxFolderStatistics
Get-EXOMailboxFolderPermissionGet-MailboxFolderPermission
Get-EXOMobileDeviceStatisticsGet-MobileDeviceStatistics
Connect-ExchangeOnlineConnect-EXOPSSession
or
New-PSSession
Connect-IPPSSession Connect-IPPSSession
Disconnect-ExchangeOnline Remove-PSSession
Get-ConnectionInformationGet-PSSession

Disconnect Exchange Online

Disconnect the remote PowerShell session when you’re finished. If you close the Exchange Online PowerShell Module window without disconnecting the session, you could use up all the remote PowerShell sessions available to you, and you’ll need to wait for the sessions to expire.

This cmdlet is the V3 equivalent of Get-PSSession | Remove-PSSession. In addition to cleaning up session object and local files, it also removes the access token from cache, which is used for authenticating against V3 cmdlets.

Disconnect-ExchangeOnline -Confirm:$false

That’s it!

Read more: How to get mailbox size greater than in Microsoft 365 »

Conclusion

You learned how to install Exchange Online PowerShell module. Connect to Exchange Online PowerShell using the Exchange Online PowerShell V3 module with or without MFA. After connecting to Exchange Online, you can use the new cmdlets.

Did you enjoy this article? You may also like Get mailbox permissions with PowerShell. Follow us on Twitter and LinkedIn to stay up to date with the latest articles.

ALI TAJRAN

ALI TAJRAN

ALI TAJRAN is a passionate IT Architect, IT Consultant, and Microsoft Certified Trainer. He started Information Technology at a very young age, and his goal is to teach and inspire others. Read more »

This Post Has 10 Comments

  1. Get-InstalledModule shows I have v3.1.0 but when I run Connect-ExchangeOnline, it shows the banner for V2. How do I resolve?

  2. I got this. what should I do?

    This V3 EXO PowerShell module contains new REST API backed Exchange Online cmdlets which doesn’t require WinRM for Client-Server communication. You can now run these cmdlets after turning off WinRM Basic Auth in your client machine thus making it more secure.

    Unlike the EXO* prefixed cmdlets, the cmdlets in this module support full functional parity with the RPS (V1) cmdlets.

    V3 cmdlets in the downloaded module are resilient to transient failures, handling retries and throttling errors inherently.

    However, REST backed EOP and SCC cmdlets are not available yet. To use those, you will need to enable WinRM Basic Auth.

    For more information check https://aka.ms/exov3-module

  3. JFC thank you for this! You’d think a simple step-by-step process like this would be documented on the MS site instead comes up with a nightmare fueled set of instructions that would shame a Stephen King novel. It took 45 minutes of googling to find the FOUR powerhell (not a typo) commands to connect to EOL …

  4. It’s like they try and make it as convoluted and unintuitive as possible. “Here’s a 17 step process to access features that really should be available in the portal, but aren’t”

Leave a Reply

Your email address will not be published. Required fields are marked *