Fix “Connect-SPOService : The term ‘Connect-SPOService’ 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.” Error

Problem: When trying to connect to SharePoint Online through PowerShell cmdlet: Connect-SPOService -URL https://crescent-Admin.SharePoint.com, Got an error message and could not connect to SharePoint Online from PowerShell:
Connect-SPOService : The term ‘Connect-SPOService’ 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.

Connect-SPOService: The term 'Connect-SPOService' 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

Solution:

This error message indicates that the particular cmdlet doesn’t exist in the loaded modules. Here, in this case, this error is because: The “Connect-SPOService” cmdlet is part of SharePoint Online Management Shell (or SharePoint Online PowerShell Module), and it is not loaded! So you must install the SharePoint Online Management shell first, before using this cmdlet. You can download and install SharePoint Online Management Shell to your client machine from https://www.microsoft.com/en-us/download/details.aspx?id=35588

install sharepoint online management shell powershell

If its already installed, try uninstalling and then re-installing.

Double check if the SharePoint Online PowerShell Module is installed by:

Get-Module -Name Microsoft.Online.SharePoint.PowerShell -ListAvailable | Select Name,Version 

You can install the SharePoint Online PowerShell Module with:

Install-Module Microsoft.Online.SharePoint.PowerShell 

For un-installation, use:

Uninstall-Module -Name Microsoft.Online.SharePoint.PowerShell -AllVersions -Force

Although we don’t have to explicitly load the module in PowerShell with “Import-Module Microsoft.Online.SharePoint.Powershell”, give it a try to expose any potential issues.

If you are trying to connect to SharePoint Online PowerShell through a proxy server, the Connect-SPOService cmdlet connections fails! You have to use:

#Get Credentials to connect
$cred = Get-Credential
[System.Net.WebRequest]::DefaultWebProxy.Credentials = $cred

Connect-SPOService -Url "https://<Tenant-admin>.sharepoint.com" -Credential $cred

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

6 thoughts on “Fix “Connect-SPOService : The term ‘Connect-SPOService’ 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.” Error

  • September 3, 2021 at 5:32 AM

    I have tried all the steps mentioned, the issue still exists in windows 10 machine

    Reply
  • May 2, 2021 at 3:30 PM

    I am also facing the same issue. None of Sharepoint Online commands seem to be working.Import-Module : Could not load type ‘Microsoft.SharePoint.Client.Publishing.PortalLaunch.PortalLaunchRedirectionType’ from
    assembly ‘Microsoft.SharePoint.Client.Publishing, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’.
    Connect-SPOService : The term ‘Connect-SPOService’ 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.Connect-SPOService : The term ‘Connect-SPOService’ 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.

    Reply
  • January 18, 2021 at 2:17 AM

    is there any fix for this issue.? I am having this problem as well.

    import-module : Could not load type ‘Microsoft.SharePoint.Client.Publishing.PortalLaunch.PortalLaunchRedirectionType’ from assembly ‘Microsoft.SharePoint.Client.Publishing, Version=16.0.0.0, Culture=neutral,
    PublicKeyToken=71e9bce111e9429c’.
    At line:1 char:1
    import-module microsoft.online.sharepoint.powershell
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    CategoryInfo : NotSpecified: (:) [Import-Module], TypeLoadException
    FullyQualifiedErrorId : System.TypeLoadException,Microsoft.PowerShell.Commands.ImportModuleCommand

    #Read more: https://www.sharepointdiary.com/2019/02/the-term-connect-sposervice-is-not-recognized-as-the-name-of-a-cmdlet-function-script-file-or-operable-program.html#ixzz6jrU5uBTe

    i have uninstalled and reinstalled SharePoint powershell module and still cannot use connect-sposervice cmdlet

    Reply
  • September 10, 2020 at 6:06 PM

    I am having this problem as well. In my case, I have two versions installed. Is this causing a conflict? I’ve tried to remove all versions, but the 16.0.20414.0 can’t be removed and might have been installed by other means other than Install-Module.

    Name Version
    —- ——-
    Microsoft.Online.SharePoint.PowerShell 16.0.20414.12000
    Microsoft.Online.SharePoint.PowerShell 16.0.20414.0

    Reply
  • September 2, 2020 at 8:44 PM

    Same here
    import-module : Could not load type ‘Microsoft.SharePoint.Client.Publishing.PortalLaunch.PortalLaunchRedirectionType’ from assembly ‘Microsoft.SharePoint.Client.Publishing, Version=16.0.0.0, Culture=neutral,
    PublicKeyToken=71e9bce111e9429c’.
    At line:1 char:1
    + import-module microsoft.online.sharepoint.powershell
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [Import-Module], TypeLoadException
    + FullyQualifiedErrorId : System.TypeLoadException,Microsoft.PowerShell.Commands.ImportModuleCommand

    Reply
  • August 17, 2020 at 3:31 PM

    I have tried all the above steps that the problem still exists.

    Reply

Leave a Reply