Today, I'm going to install the SharePoint Online Management Shell on a new machine, and there are some problems and notes.
First the SharePoint Online Management Shell download Address: https://www.microsoft.com/en-us/download/details.aspx?id=35588
Both the download and installation are smooth, and after the installation is complete, the "as Administrator" opens without prompting the error directly:
"Import-module:the specified Module ' Microsoft.Online.SharePoint.PowerShell '
was not loaded because no valid module file is found in any module directory. "
Error screenshot:
From the error message you can see that the Microsoft.Online.SharePoint.PowerShell module is not found, use Get-module to find out:
It is not found, it is possible to find the path is not correct, use $env:psmodulepath this environment variable to see all the module path:
Sure enough, there is no path to the SharePoint Online Maangement Shell, and the folder where the SharePoint Online Maangement Shell is installed is:
So you need to add this path to the $ENV variable:
And then look it over again to see:
Using the Import-module command to import this module is available:
But using the command line to directly modify the way $env, only temporarily modified, the next time you reopen the SharePoint Online Management Shell, you will also see the same problem of missing module.
A straightforward solution is to add this path to the environment variable as follows: