1

I have to delete one of my SharePoint site but unfortunately I can only do it using PowerShell

However when I try to use the Connect-SPOService command, I get this error message:

“Connect-SPOService: The term 'Connect-SPOService' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.”

So here is what I did:

1 – I installed the latest version of PowerShell from https://aka.ms/powershell-release?tag=stable

Note: My environment is a Windows Server 2016

2 – I installed the SharePoint Online Management Shell using the following command

Install-Module -Name Microsoft.Online.SharePoint.PowerShell

But I tried to run the Connect-SPOService command, I got the error mentioned above.

Now the interesting thing is that when I run:

Get-Module -ListAvailable *sharepoint*, I get this

Directory: D:\Users\<path of my business OneDrive>\Documents\PowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Binary     16.0.2151…            Microsoft.Online.SharePoint.PowerS… Desk

Why is the ExportedCommands is empty?

Why did the SharePoint Online Management Shell get installed under my OneDrive path and not under the location where PowerShell 7 got installed which is “C:\Program Files\PowerShell\7”

What can I do so the Connect-SPOService command works?

Thanks

Christophe

0

looks like the issue with the different dlls in your GAC,

try run this command, check the output.

Get-ChildItem -Path C:\Windows\Microsoft.NET\assembly\GAC_MSIL\*Microsoft.SharePoint*.dll -Recurse | ft Name,@{Label="Version";Expression={$_.VersionInfo.FileVersion}} -AutoSize

if file versions are different thats your problem.Remove the one and test it.

Check this url for the detailed instruction.

The term ‘Connect-SPOService’ is not recognized

5
  • I saw the above post before posting my issue. The DLLs have the same version ---- ------- Microsoft.SharePoint.BusinessData.Administration.Client.dll 15.0.4420.1017 Microsoft.SharePoint.BusinessData.Administration.Client.Intl.dll 15.0.4420.1017 Microsoft.SharePoint.Client.Runtime.Local.Resources.dll 15.0.4420.1017 Sep 5 at 15:07
  • But DLLs listed are different than in easy365manager.com/… Sep 5 at 15:11
  • the dll you posted above are not the correct, you have to check the Microsoft.SharePoint.Client dlls.
    – Waqas Sarwar MVP
    Sep 5 at 17:57
  • I know. This is why I created this post. Sep 5 at 22:15
  • See my question above > Why did the SharePoint Online Management Shell get installed under my OneDrive path and not under the location where PowerShell 7 got installed which is “C:\Program Files\PowerShell\7” Sep 5 at 22:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.