How to install PnP PowerShell and connect with SharePoint Online.

By Dipak Shaw

January 31, 2021


Office365, PowerShell, SharePointPnPPowerShell

PnP stands for Pattern and Practices which contains various PowerShell commands that we can use to perform complex actions in SharePoint. You can install PnP PowerShell for different SharePoint versions.

We will use the below command in PowerShell:

To Install:

  • Install-Module SharePointPnPPowerShellOnline
  • Install-Module SharePointPnPPowerShell2013
  • Install-Module SharePointPnPPowerShell2016
  • Install-Module SharePointPnPPowerShell2019

To Update:

  • Update-Module SharePointPnPPowerShellOnline
  • Update-Module SharePointPnPPowerShell2013
  • Update-Module SharePointPnPPowerShell2016
  • Update-Module SharePointPnPPowerShell2019

To Uninstall:

  • Uninstall- Module SharePointPnPPowerShellOnline
  • Uninstall- Module SharePointPnPPowerShell2013
  • Uninstall- Module SharePointPnPPowerShell2016
  • Uninstall- Module SharePointPnPPowerShell2019

Step: 1) Installing the SharePoint PnP PowerShell

Run the PowerShell in Administrator Mode and use the install command according to your SharePoint version from above. It will prompt you untrusted repository, type A and hit enter, it will then install the SharePoint Online PnP PowerShell.

It is installed successfully.

To check the installed version of SharePoint PnP PowerShell just run the following command:

Get-Module SharePointPnPPowerShellOnline -ListAvailable | Select-Object Name, Version | Sort-Object Version -Descending

It will show you the SharePointPnPPowerShellOnline version that is installed in your system. Refer the below image.

Step: 2) Connecting with SharePoint site.

To connect with your SharePoint site run the following command in PowerShell.

Connect-PnPOnline -Url (site url) -Credentials (Get-Credential)

It will popup a dialog to enter the credential. Enter the credential and now it is connected successfully with your SharePoint site.

To check whether it is connected successfully we will test by getting all the list in that site. So run the following command and it will show all the lists in it.

Get-PnPList

Well, That’s the end of this post. Let me know if you have any query or suggestion in comment below. I’ll see you next time. 🙏😊

Leave a Reply

Your email address will not be published. Required fields are marked

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}