Connect-PnPOnline : The term 'Connect-PnPOnline' 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.

Problem: When trying to run a PowerShell script for SharePoint Online, got this error message:
"Connect-PnPOnline : The term 'Connect-PnPOnline' 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."

Connect-PnPOnline : The term 'Connect-PnPOnline' 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

Case 1: PnP PowerShell Module is not Installed
Usually, this error occurs when you don't have the PnP PowerShell module for SharePoint Online is installed on the local machine.  So, to get rid of this error, you must install "SharePointPnPPowerShellOnline" module as:
Install-Module SharePointPnPPowerShellOnline 
More information on installing PnP PowerShell module for SharePoint online is here: How to Install PnP PowerShell Module for SharePoint Online?

Case 2: Multiple Versions of PnP PowerShell Module is installed and there is a Conflict!
In some cases, this error could be because of multiple versions of the SharePoint Online PnP PowerShell module installed and conflicting! Close all running instances of PowerShell and PowerShell ISE, Open a new PowerShell window as Administrator and run these steps:
  • Step 1: Get All Installed versions of SharePoint Online PnP PowerShell
  • Get-Module SharePointPnpPowerShellOnline -ListAvailable | select Name,Version
    This would give you all versions of the specific module.

  • Step 2: Uninstall All Installed SharePoint Online PnP PowerShell Modules
    Uninstall-Module SharePointPnPPowerShellOnline -AllVersions -Confirm:$False      

  • Step 3: Install the latest versions of SharePoint Online PnP PowerShell
    Install-Module SharePointPnPPowerShellOnline
The term 'Connect-PnPOnline' is not recognized as the name of a cmdlet, function, script file, or operable program

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.