Connect-SPOService : Could not connect to SharePoint Online when using SharePoint 2019 Management Shell.

Tevon2.0 1,101 Reputation points
2022-11-23T14:27:40.223+00:00

Greetings I ask that you please provide guidance with the understanding that this is an “on-premise” SharePoint farm (I'm in a sandbox environment).

I was curious as to why I receive the error message below when trying to connect to SharePoint in the Management Shell? Also, from my understanding after Connect-SPOServerice I am supposed to place my site home page for the URL and then credentials which would be my SharePoint login email correct?

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.
At line:1 char:1

  • Connect-SPOService -Url https://tking-admin.sharepoint.com
  • ~~~~~~~~~~~~~~~~~~
  • CategoryInfo : ObjectNotFound: (Connect-SPOService:String) [], CommandNotFoundException
  • FullyQualifiedErrorId : CommandNotFoundException
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,773 questions
0 comments No comments
{count} votes

5 answers

Sort by: Most helpful
  1. JimmySalian-2011 42,056 Reputation points
    2022-11-23T15:01:49.91+00:00

    Hi,

    Did you downloaded and installed SPO management shell? As the command requires SPO Shell details.aspx

    Hope this helps.
    JS

    ==
    Please Accept the answer if the information helped you. This will help us and others in the community as well.


  2. Xuyan Ding - MSFT 7,561 Reputation points
    2022-11-24T07:43:25.11+00:00

    Hi @Tevon2.0 ,

    You need to run the command with the SharePoint Online management shell, and you need to connect as an administrator.
    263786-image.png
    Reference: Connect-SPOService
    Get started with SharePoint Online Management Shell

    In addition, I tested it with SharePoint 2019 Management PowerShell and installed the SharePoint Online PowerShell Module on it, but the same problem will occur. If you encounter such an error when using SPO management shell or Windows PowerShell, you can check whether the SharePoint Online PowerShell Module is installed, check and install it according to the command in the above reference article.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  3. Tevon2.0 1,101 Reputation points
    2022-11-25T17:18:02.69+00:00

    The tips in the posted documentation did not fix the issue unfortunately. Still seeing this error message.

    PS C:\Users\tking> Connect-SPOSevice
    Connect-SPOSevice : The term 'Connect-SPOSevice' 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

    • Connect-SPOSevice
    • ~~~~~~~~~~~~~~~~~
    • CategoryInfo : ObjectNotFound: (Connect-SPOSevice:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

    I already used the following commands as well

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


  4. Tevon2.0 1,101 Reputation points
    2022-12-01T13:42:54.647+00:00

    @Xuyan Ding - MSFT I Opened SharePoint 2019 Management Shell as an administrator and when it opened I saw this

    Exception calling "GetEndOfSupportMessage" with "3" argument(s): "Login failed for user 'LINGUALISTEK\tking'."
    At C:\Program Files\Common Files\Microsoft Shared\Web Server
    Extensions\16\CONFIG\POWERSHELL\Registration\SharePoint.ps1:12 char:1

    • $adminWebApp.GetEndOfSupportMessage($false, [ref]$endOfSupportSeverit ...
    • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : SqlException

    Then I entered "Install-Module -Name Microsoft.Online.SharePoint.PowerShell" and received the message below.

    PS C:\Users\tking> Install-Module -Name Microsoft.Online.SharePoint.PowerShell
    WARNING: Unable to resolve package source 'https://www.powershellgallery.com/api/v2'.
    PackageManagement\Install-Package : No match was found for the specified search criteria and module name
    'Microsoft.Online.SharePoint.PowerShell'. Try Get-PSRepository to see all available registered module repositories.
    At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1809 char:21

    • ... $null = PackageManagement\Install-Package @PSBoundParameters
    • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Ex
      ception
    • FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

  5. David Dawson 100 86 Reputation points
    2024-06-27T18:17:49.5233333+00:00

    I'm still having trouble with this in 2024 I don't know why PS 7.4 hasn't been updated to support these commands. I finally found that if you force PS 5.1 then all the Connect-SPO commands work because they're supported in that version. I forced it by using Powershell, which launches in 7.4.3 for me, then running "powershell -version 5.1". I can manage SharePoint Online using Powershell now.

    0 comments No comments