PnP PowerShell overview
The SharePoint Patterns and Practices – short name PnP is a collection library which contains array of PowerShell commands – named as PnP PowerShell which allows us(SharePoint administrator or developer) to perform complex provisioning and artifact management actions in SharePoint.
The PnP powershell is built on SharePoint CSOM powershell framework – which can work against both the SharePoint Online and SharePoint On-Premises(SharePoint 2019, SharePoint 2016, SharePoint 2013).
There are so many ways to install the SharePoint PnP Powershell, This is one of the approach for installation on machines that have at least PowerShell v3 installed.
Verify that which version of PowerShell is installed in the machine:
We can find the version of PowerShell by opening PowerShell and running $PSVersionTable.PSVersion. In this result of command – the major version should be above 3.
To install the “SharePointPnPPowerShellOnline” we need to run the below powershell command which will install PowerShell Package Management and then install the PowerShell Modules from the PowerShell Gallery.
The above command execution example:
If we have OS windows 10 machine – we can run the below command directly from SharePoint Online Management Shell:
- SharePoint Online: Install-Module SharePointPnPPowerShellOnline
- SharePoint 2016: Install-Module SharePointPnPPowerShell2016
- SharePoint 2013: Install-Module SharePointPnPPowerShell2013
The above points explained which command should be executed in which version of SharePoint.
If the SharePointPnPPowerShellOnline module is not installed in the machine properly and try to execute the Connect-PnPOnline command, we will get the below error:
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. At line:1 char:1 + Connect-PnPOnline + ~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Connect-PnPOnline:String) , C ommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
Thus, in this article we have learned the below topics:
- Overview of PnP PowerShell.
- How to install the SharePointPnPPowerShellOnline module using script.
- How to Install-Module SharePointPnPPowerShellOnline in SharePoint Online.
- How to Install-Module SharePointPnPPowerShell2016 in SharePoint 2016.
- How to Install-Module SharePointPnPPowerShell2013 in SharePoint 2013.
- How to fix “the term ‘Connect-PnPOnline’ is not recognized as the name of a cmdlet, function”