This SharePoint tutorial explains, how to fix error connect-sposervice the term ‘connect-sposervice’ is not recognized as the name of a cmdlet PowerShell SharePoint. The error comes while running the Connect-SPOService cmdlet.
connect-sposervice the term ‘connect-sposervice’ is not recognized
Recently, while working with SharePoint Online to add a new theme in SharePoint Online using PowerShell, I got the error.
Connect-SPOService -Url https://tsinfo-admin.sharepoint.com/ -credential Bijay@tsinfo.onmicrosoft.com
I got an error which says:
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://tsinfo.sharepoint.com/ -credential De …
~~~~~~- CategoryInfo : ObjectNotFound: (Connect-SPOService:String) [], CommandNotFoundException
- FullyQualifiedErrorId : CommandNotFoundException
I was also writing the below PowerShell script to add the custom theme to the SharePoint Online site.
Add-SPOTheme -Name $themeName -Palette $palette -IsInverted:$false -Overwrite
Add-SPOTheme: The term ‘Add-SPOTheme’ 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:30 char:1
- Add-SPOTheme -Name $themeName -Palette $palette -IsInverted:$false -O …
~~~~- CategoryInfo : ObjectNotFound: (Add-SPOTheme:String) [], CommandNotFoundException
- FullyQualifiedErrorId : CommandNotFoundException: The term ” 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:31 char:1
- ~
- CategoryInfo : ObjectNotFound: (:String) [], CommandNotFoundException
- FullyQualifiedErrorId : CommandNotFoundException

The error was coming because SharePoint Online Management Shell is not installed in our local system.
Below is the code to check whether SharePoint Online Management Shell is available in our local system or not:-
Get-Module -Name Microsoft.Online.SharePoint.PowerShell -ListAvailable | select Name,Version
If the SharePoint Online management shell is not installed, then you can run the below command to install the latest version of SharePoint Online management shell.
Install-Module -Name Microsoft.Online.SharePoint.PowerShell
You may like following PowerShell tutorials:
- How to create a communication site in SharePoint using PowerShell
- How to connect SharePoint Online using PnP PowerShell
- How to change SharePoint Online Modern Site Theme (Create a custom theme)
- Remove all items from a SharePoint Online list using PnP PowerShell
Here, we learned how to fix error connect-sposervice the term ‘connect-sposervice’ is not recognized as the name of a cmdlet.
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com
Zero help resolving the issue.
Did you install the below command and check if the SharePoint online management shell is installed or not?
Get-Module -Name Microsoft.Online.SharePoint.PowerShell -ListAvailable | select Name,Version
If not installed, you can run the below command:
Install-Module -Name Microsoft.Online.SharePoint.PowerShell
Hi! On the off chance you get a notification for the resurrection of this question …
I’m experiencing the exact problem you’ve detailed, but I actually am running the SP Online Mgmt Shell. When I run the command you listed, the return is:
Microsoft.Online.SharePoint.PowerShell 16.0.22810.12000
Microsoft.Online.SharePoint.PowerShell 16.0.22713.12000
Microsoft.Online.SharePoint.PowerShell 16.0.22713.12000
Microsoft.Online.SharePoint.PowerShell 16.0.22713.0
Many responses to this problem all say the same thing you’ve said, which is great advice, but in my case I actually am running the module, so I’m stumped. Any advice? Much appreciated!