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?