In this SharePoint PowerShell tutorial we will discuss how to solve Install-Module : The term ‘Install-Module’ is not recognized as the name of a cmdlet, function, script file, or operable program error which comes while running Install-Module SharePointPnPPowerShellOnline command to install PnP SharePoint Online.
Install-Module : The term ‘Install-Module’ is not recognized as the name of a cmdlet, function, script file, or operable program
Recently, I was trying to use PnP PowerShell to connect to SharePoint Online sites.
To install PnP PowerShell cmdlets, I was trying to install Install-Module SharePointPnPPowerShellOnline. But it gave me error as:
Install-Module : The term ‘Install-Module’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1Install-Module SharePointPnPPowerShellOnline. CategoryInfo : ObjectNotFound: (Install-Module:String) , CommandNotFoundException FullyQualifiedErrorId : CommandNotFoundException
The error looks like below:
The error usually comes, if your PowerShell is upto date. The major version of PowerShell should be equal or greater than 5. You can run the below cmdlets to check the PowerShell version.
My PowerShell major version was 4.
To solve the error follow below steps.
Download Windows Management Framework 5.1
Here make sure to choose Win8.1AndW2K12R2-KB3191564-x64.msu if you have Windows server 2012 or 2012 R2 machine.
Download and install Download Windows Management Framework 5.1, then it will ask to restart the machine like below:
You may like following SharePoint PowerShell tutorials:
- 15 PowerShell Basic Commands Examples
- Working with PowerShell Date Command (Get-Date)
- PowerShell Basics: A Beginners Guide
- SharePoint Online Automation: Upload Files Remotely to SharePoint Online Document Library using PowerShell
- What is a PowerShell Variables
- SharePoint 2016 PowerShell Script to list all Users in Site Collection
- SharePoint 2013 backup and restore using PowerShell
- SharePoint Online storage limits
- Get SharePoint document library size using PowerShell
Once you restart the machine and try running Install-Module SharePointPnPPowerShellOnline command, the error will not come.
I am Bijay a Microsoft MVP (8 times – My MVP Profile) in SharePoint and have more than 15 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com