Remove-MsolUser not recognized

Recently, I was trying to delete a user from my Microsoft Entra ID when I suddenly got this error.

I was executing the below command

Remove-MsolUser -UserPrincipalName "test@fewlines4bijuhotmail.onmicrosoft.com"

After executing, I got this error. Check out the screenshot below

Remove-MsolUser not recognized

The complete error message is as below

Remove-MsolUser : The term 'Remove-MsolUser' 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.
At line:1 char:1
+ Remove-MsolUser -UserPrincipalName "test@fewlines4bijuhotmail.onmicro ...
+ ~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Remove-MsolUser:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Table of Contents

Solution

To fix this issue, I installed the Remove-MsolUser module using the below Azure PowerShell command.

Install-Module MSOnline

The module was installed successfully. Check out the screenshot below.

The term 'Remove-MsolUser' is not recognized
The term 'Remove-MsolUser' is not recognized as the name of a cmdlet

Now I reran the below PowerShell command, and this time, it executed successfully. Check out the screenshot for reference.

'Remove-MsolUser' is not recognized

The user has been deleted successfully from the list. Check out the screenshot below for your reference.

Remove-MsolUser is not recognized

Video Tutorial

Azure Virtual Machine

DOWNLOAD FREE AZURE VIRTUAL MACHINE PDF

Download our free 25+ page Azure Virtual Machine guide and master cloud deployment today!