Author Details

avatar-teacher

Evolvous

We are a team of tech enthusiast and this section is where we love to share our experience and our knowledge. We try our best to help you understand technical topics by giving you live instances of how-to’s, guides, tips, FAQ’s and troubleshoots.

If you like it or have questions, do share your feedback in the comments section below.

How to install PnP PowerShell and connect with SharePoint Online

Table of Contents 

  1. What is PnP PowerShell? 
  2. Why do we need PnP PowerShell? 
  3. Step to install Windows PowerShell  
  4. Step to run PowerShell as administrator. 
  5. How to install PnP PowerShell and Connect with SharePoint Online 
  6. Advantage & Disadvantage of PnP PowerShell

What is PnP PowerShell? 

PnP stands for “Pattern and Practices”, PnP.PowerShell is a new cross-platform PowerShell module released that contains more than 600 cmdlets to work with various Microsoft 365 environments like SharePoint Online, Microsoft Power Automate or Flow, Microsoft Teams, Microsoft Planner, etc. 

Why do we need PnP PowerShell? 

The Microsoft SharePoint Online Services module remains the de facto management tool for that service with basic commands to connect, add, update and remove items such as site collections, sites and libraries. 

PnP PowerShell internally implements Client-Side Object model for its operations. This, in turn, makes the operations adaptable. The same set of operations can be executed on any SharePoint environment. Using PnP PowerShell, the single line of code is used to access any object on SharePoint, where in with traditional client side or server-side object model, multiple lines of code are required to access the objects. The code complexity reduces through this implementation.

If you are using the PowerShell 5.x, then better to upgrade to PowerShell 7.x.  

  1. Download the PowerShell-7.x.msi file and then run the .msi file. 

2. Click on Next -> Next -> and then click on Install. 

3. Once you click on Install, it will take some time to install, and you can see the progress. 

4. After Installation Completed Successfully, Click on Finish  

To run PowerShell as administrator on a pinned item: 

          1.Find the PowerShell icon in the search box again. 

          2.Right-click on the PowerShell icon and select Pin to Start or Pin to Taskbar.

3. Click on the Start button 

4. Look for Windows PowerShell (or PowerShell Core) on the right side of the Start Menu. 

5. Right-click on the menu item and choose Run as administrator. 

How to install PnP PowerShell for SharePoint Online? 

To install the new PnP PowerShell module, these have to follow Steps:  

Step1. Uninstall the Legacy SharePointPnPPowerShellOnline Module if installed already and Run below the command: 

Uninstall-ModuleSharePointPnPPowerShellOnline – Force – AllVersions

Step2: Install the New PnP PowerShell Module and Run Below the command: 

Install-Module PnP.PowerShell

Step3:  In case you are not a global admin, we need to run the below command to register Azure AD Application and Grant Access to the Office 365tenantlikebelow: 

Register-PnPManagementShellAccess

Note: This command will require when execute operation that require higher level Permission and different authentication method  

How to install PnP PowerShell and connect with SharePoint Online

Step4 Connect SharePoint online Site using PnP PowerShell Run below the Command  

Connect-PnPOnline -Url https://evolvous.sharepoint.com/

Step5: Get all the lists from a SharePoint site by Run below the PnP PowerShell command: 

Get-PnPList

How to install PnP PowerShell and connect with SharePoint Online

Step6: Update PnP PowerShell for SharePoint Online Running below the Command 

Update-Module -Name “PnP.PowerShell”

How to install PnP PowerShell and connect with SharePoint Online

How to install PnP PowerShell and connect with SharePoint Online

Step7: Check PnP PowerShell Version Running below the command  

Get-Module -Name Microsoft.Online.SharePoint.PowerShell -ListAvailable | Select-Object Name, Versions

How to install PnP PowerShell and connect with SharePoint Online

$PSVersionTable.PSVersion

How to install PnP PowerShell and connect with SharePoint Online

Advantage of PnP PowerShell 

  1. Extensible format system 
  2. Built in data formats 
  3. Secure scripting engine  
  4. Consistent API 
  5. Self-Service development 
  6. Extend type System

Disadvantage of PnP PowerShell

  1. Parallel tasking for more data intensive operations is challenging 
  2. Not much options for extensibility besides the ones provided 
  3. Not all Site operations such as taxonomy field updates (unless do XML schema update) are supported yet 
  4. No toolchain to build from: Simple JS/ CSS / PnP scripts 

Looking support for PnP PowerShell for SharePoint Online Contact us

=====

Plus read

Horizontal Scrollable for Vertical Gallery in PowerApps using Slider Control

Populate SharePoint List Column Values Into PowerApps Combo Box