Import-Module: The specified module ‘Microsoft.Online.SharePoint.Powershell’ was not loaded because no valid module file was found in any module directory.

Problem:
When trying to add the PowerShell module for SharePoint Online, using “Import-Module Microsoft.Online.SharePoint.PowerShell”, it resulted in the below error in both PowerShell console and in PowerShell ISE.
“Import-Module : The specified module ‘Microsoft.Online.SharePoint.Powershell’ was not loaded because no valid module file was found in any module directory.”

Import-Module-The specified module 'Microsoft.Online.SharePoint.Powershell' was not loaded because no valid module file was found in any module directory.

Solution: 

  • Make sure you have SharePoint Online Management Shell installed on the machine you are getting the error. You can download and install SharePoint Online Management Shell from: https://www.microsoft.com/en-us/download/details.aspx?id=35588
    download and install sharepoint online managment shell
    You can check installed modules by: Get-Module -listavailable
  • If you are getting this error in SharePoint Online Management Shell, make sure you removed x86 version of the SharePoint Online management shell from your computer, and Try download and Re-Install 64bit version!
  • Try running: Set-ExecutionPolicy Unrestricted once
  • Run PowerShell or PowerShell ISE as an administrator
  • Check the module path to your environment variables How to verify PowerShell Module’s Path?

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

Leave a Reply

Your email address will not be published. Required fields are marked *