Hi Everyone this is Prem, I have worked as M365 Support Ambassador. In this blog I will share How to Fix The term ‘Get-Mailbox’ is not recognized as the name of a cmdlet, function, script file, or operable program Error when using PowerShell.
This Error occurs when we try to run an Exchange command in PowerShell without connecting it to Exchange Online.
To fix this error we will first have to connect the PowerShell to exchange online and then run the required command.
Steps to fix The term ‘Get-Mailbox’ is not recognized as the name of a cmdlet, function, script file, or operable program Error:
Search for windows PowerShell and then run it as an administrator:
It should look like this:
Now connect to Exchange online using the PowerShell, run the following command:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
Allow it to set the execution policy if prompted by entering A
After that run:
Install-Module -Name ExchangeOnlineManagement
Allow permission to install by typing Y and hit Enter, After that run:
Import-Module -Name ExchangeOnlineManagement
Once the above commands completes without any error then run the below command to connect to Exchange Online:
Connect-ExchangeOnline
Enter your Global or Exchange Admin email address & password when prompted and it should get connected to Exchange Online on the PowerShell:

Once it is connect you can then run the Get-Mailbox command which you wanted and it should be able to bring the Output without any error.
Date:28/02/2023
Author: Prem
Tags: The term ‘Get-Mailbox’ is not recognized