PnP PowerShell - How To Get Started?

Introduction

PnP PowerShell module, i.e., PnP.PowerShell is a cross-platform product, which means that it can be used on Windows, macOS, or Linux. It offers more than 600 cmdlets to interact with the many Microsoft 365 services, including SharePoint Online, Microsoft Teams, Microsoft Planner, and others. The name SharePointPnPPowerShellOnline was previously used for this module, but it is no longer in use or supported. Only the newest version will receive active maintenance. However, this more recent version will only support SharePoint Online and will not support any on-premise products.

I believe it is an essential tool for anyone involved in Microsoft SharePoint customizations, such as SharePoint Developers, SharePoint Architects, or SharePoint Administrators, to manage SharePoint environments. In this article, I’ll show you how to install and configure the module.

Installation

Follow the below-mentioned steps to install the module,

Step 1 - Open The Windows PowerShell

Since we will be installing a new module, administrator permission will be required. So open the Windows PowerShell Console as an Administrator:

PnP PowerShell

Step 2 - Install The Module

Run the below mentioned command to install the module,

Install-Module -Name PnP.PowerShell

PnP PowerShell

For nightly build of PnP PowerShell, use this command,

Install-Module -Name PnP.PowerShell -AllowPrerelease -SkipPublisherCheck -AllowClobber

You can also download the offline package from here and run the below mentioned command to install,

Install-Package D:\Packages\pnp.powershell.1.11.0.nupkg

Important Note(s)

  • For above command, my offline package is available at D:\Packages path and package name is pnp.powershell.1.11.0.nupkg. So make sure to update the path and package name as required.
  • PowerShell 7.x is required to support all the commands and most of the command will work in PowerShell 5.x as well. However, it is better to upgrade to PowerShell 7.x if you have the lower version already installed.

Once the module is installed, run the below mentioned command to verify the installation:

Get-Command -Module PnP.Powershell

PnP PowerShell

Uninstall Legacy Version

If you are already using an older version of the PnP PowerShell, such as SharePointPnPPowerShellOnline, uninstall it before proceeding with the steps outlined above. To uninstall this, use the following command:

Uninstall-Module SharePointPnPPowerShellOnline -Force –AllVersions

Now that your development environment is ready, use it to connect to the SharePoint site collection.

I hope you enjoyed reading this blog post. Please feel free to leave a comment in case you have any feedback, suggestions, or queries.