Hi @IniobongNkanga-8038,
Thank you for posting in this community.
The error “Connect-SPOService is not recognized as the name of a cmdlet” occurs when the SharePoint Online Management Shell module is not installed or loaded in the current PowerShell session. To resolve this error, follow these steps:
Option 1: Download and Install SharePoint Online Management Shell
You can download and install SharePoint Online Management Shell to your client machine from SharePoint Online Management Shell.
If it’s already installed, try uninstalling and then re-installing.
Option 2: Install SharePoint Online PowerShell Module
Double-check if the SharePoint Online PowerShell Module is installed by:
Get-Module -ListAvailable -Name Microsoft.Online.SharePoint.PowerShell | Select Name,Version
You can install the SharePoint Online PowerShell Module with the following:
Install-Module Microsoft.Online.SharePoint.PowerShell
For uninstallation, use:
Uninstall-Module -Name Microsoft.Online.SharePoint.PowerShell -AllVersions -Force
This will install necessary assemblies (.dll files) to the path: C:\Program Files\WindowsPowerShell\Modules\Microsoft.Online.SharePoint.PowerShell<Build-Number>
Other Workarounds:
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 the SharePoint site from PowerShell through a proxy server, the Connect-SPOService cmdlet connections fail! You have to use the following method to connect to SPO Service:
#Get Credentials to connect
$cred = Get-Credential
[System.Net.WebRequest]::DefaultWebProxy.Credentials = $cred
#Connect to SharePoint Online Administration Center
Connect-SPOService -Url "https://<Tenant-admin>.sharepoint.com" -Credential $cred
In another situation, I had to delete all different versions of SharePoint Online client Assemblies from the Global Assembly Cache (GAC) and then install the SharePoint Online PowerShell Module:
- Navigate to “C:\Windows\Microsoft.NET\assembly\GAC_MSIL”
- Select all folders starting with the name “Microsoft.SharePoint.Client” and delete them all!
- Finally, Install the PowerShell Module for SharePoint Online: Install-Module Microsoft.Online.SharePoint.PowerShell -force
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.