Search code examples
powershellsharepoint-onlinepowershell-cmdlet

Getting error when I try using Sharepoint Online power shell commands


When I try to execute Powershell command, it gives the error: 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.

Tried uninstalling and reiinstalling S P Online Management shell. None of the SPO commands are working.


Solution

  • On my system this came down to a conflicting .dll (different versions) that was found in both the SharePoint PowerShell module folder and the Global Assembly Cache.

    I deleted the following file from the GAC:

    C:\Program Files\WindowsPowerShell\tmp\Microsoft.SharePoint.Client.Publishing\v4.0_16.0.0.0__71e9bce111e9429c\Microsoft.SharePoint.Client.Publishing.dll
    

    After that everything was running smoothly. Full details on research leading to this is found here: https://www.easy365manager.com/the-term-connect-sposervice-is-not-recognized/