Share via


SharePoint Online PowerShell command doesn't work correctly

Symptoms

When you run a command in SharePoint Online Management Shell, the command doesn't run as expected and doesn't return any results. Or, you receive the following error message:

The term '<command>' is not recognized as the name of the 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.

Cause

This issue occurs in one of the following situations:

  • Multiple older versions of the SharePoint Online PowerShell module are installed on your computer.
  • The SharePoint Online PowerShell module isn't installed on your computer.

Resolution

To resolve this issue, follow these steps:

  1. Run the following command to get a list of all the versions of the SharePoint Online PowerShell module that are installed on your computer:

     Get-Module -Name Microsoft.Online.SharePoint.PowerShell -ListAvailable
    

    If the command doesn't return a result, go to step 4. Otherwise, go to step 2.

  2. Uninstall SharePoint Online Management Shell in Settings or Control Panel.

  3. Uninstall all previous versions of the SharePoint Online Management Shell module that were installed by using PowerShell:

    1. Open an elevated PowerShell window. To open the window, enter powershell in the search box. In the results, right-click Windows PowerShell, and then select Run as administrator.

    2. Run the following command:

      Uninstall-Module Microsoft.Online.SharePoint.PowerShell -Force -AllVersions
      
  4. Install SharePoint Online Management Shell.

    Note

    Make sure that you review the system requirements and installation instructions before you install the module.