Office 365: Getting started with SharePoint PnP PowerShell – installation

One comment

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.

SharePoint PnP Powershell installation - Install-Module SharePointPnPPowerShellOnline
SharePoint PnP Powershell installation – Install-Module SharePointPnPPowerShellOnline

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. 

(New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/sharepoint/PnP-PowerShell/master/Samples/Modules.Install/Install-SharePointPnPPowerShell.ps1')

The above command execution example:

SharePoint PnP Powershell installation - Install-Module SharePointPnPPowerShellOnline - script execution
SharePoint PnP Powershell installation – Install-Module SharePointPnPPowerShellOnline

 

 

Notes:

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

 

 

Summary:

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”

 

Free download SharePoint Online & Office 365 Administration eBook(238 Pages)

Get the PDF eBook from here:




 

 
FREE DOWNLOAD

Send download link to:

Subscribe to get exclusive content and recommendations every month. You can unsubscribe anytime.

 

1 comments on “Office 365: Getting started with SharePoint PnP PowerShell – installation”