Fix “Connect-ExchangeOnline Cmdlet Not Recognized” Error in PowerShell
Problem:
When I tried to connect to Exchange Online from PowerShell, I received the error message: “Connect-ExchangeOnline : The term ‘Connect-ExchangeOnline’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.”
Solution:
The ‘Connect-ExchangeOnline’ cmdlet is used to establish a remote PowerShell session with Exchange Online in Microsoft 365. You need to run this cmdlet to execute Exchange Online admin functionalities using PowerShell. If you receive the above error message, Here are the steps to resolve this:
1. Install the ExchangeOnlineManagement Module
The Connect-ExchangeOnline cmdlet is part of the ExchangeOnlineManagement module, which is used to manage Exchange Online in Office 365. You must install the ExchangeOnlineManagement module to resolve this issue.
Install-Module ExchangeOnlineManagement
2. Import the ExchangeOnlineManagement Module:
Import the ExchangeOnlineManagement Module – you might need to import the module into your PowerShell session explicitly:
Import-Module ExchangeOnlineManagement
3. Try Connecting Again: After importing, try running the Connect-ExchangeOnline
cmdlet again.
4. Reopen PowerShell: Sometimes, simply closing and reopening your PowerShell session (or the PowerShell ISE) can help.
5. The PowerShell version may be outdated: Check whether you installed the latest PowerShell version on your system. You need Windows PowerShell version 5.1 or later for the ‘Connect-ExchangeOnline’ cmdlet to work correctly. Refer: How to Update PowerShell?
If you follow these steps and still encounter issues, it’s possible there might be other environmental factors or configurations affecting the behavior.