Fixed The term ‘Set-Mailbox’ is not recognized as the name of a cmdlet Error

Hi Everyone this is Prem, I have worked as M365 Support Ambassador. In this blog I will share How to fix The term ‘Set-Mailbox’ is not recognized as the name of a cmdlet Error when running command in powershell.

 

Error can occurs when you try to run an Exchange Online command in PowerShell without first connecting it to Exchange Online.

 

In order to fix this error we should first connect the PowerShell to exchange online and then run the needed command.

 

Steps to fix The term ‘Set-Mailbox’ is not recognized as the name of a cmdlet Error:

Search for Windows PowerShell on the computer and then run it as an administrator:

Fixed The term ‘Set-Mailbox’ is not recognized

 

It should look like this if its open with the Admin rights:

Fixed The term ‘Set-Mailbox’ is not recognized

 

 

Now to connect to Exchange online using the PowerShell window opened with the steps above, run the commands one by one:

 

Install-Module -Name ExchangeOnlineManagement

Allow permissions to install by typing A and hit Enter, After it installs successfully then run:

 

Import-Module -Name ExchangeOnlineManagement

If the import command gives error that running script is disabled or other error when running the first Install command, then run the below command and after that run the above Install and Import commands again:

 

Set-ExecutionPolicy Remotesigned -scope currentuser

Allow it to set the execution policy if prompted by entering either A or Y.

 

Install-Module -Name ExchangeOnlineManagement 
 
Import-Module -Name ExchangeOnlineManagement

Once the above commands complete without any error then run the command to connect to Exchange Online:

 

Connect-ExchangeOnline

Fixed The term ‘Set-Mailbox’ is not recognized

 

Enter your Global Admin or Exchange Admin email address & password when prompted and it should get connected to Exchange Online on the PowerShell:

 

The term ‘Set-Mailbox’ is not recognized as the name of a cmdlet

Once it is connected you can then run the command which you were trying before, and it should be able to execute without any error.

 

If you have any question please mention that in the comments.

 

Date:03/03/2023

Author: Prem

Tags: Fixed The term ‘Set-Mailbox’ is not recognized as the name of a cmdlet Error

Leave a Comment

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