Finding your feet with PnP PowerShell part 1

Introduction

In this series, we will look at PnP PowerShell discover what it is and how it can be used to manage your Microsoft 365 tenants. In this post focus on what PnP PowerShell is, how to install at and run some simple cmdlets.

What is PnP PowerShell?

Microsoft describes PnP PowerShell as ‘a cross-platform PowerShell Module providing over 500 cmdlets that work with Microsoft 365 environments.’

These cmdlets focus primarily on:

  • SharePoint Online
  • Microsoft Teams
  • Microsoft Planner
  • Power Automate.

How to install PnP PowerShell

Before you can install the PnP PowerShell module, you’ll need to have already installed the SharePoint Online Management Shell, from the PowerShell Gallery.

You can see if you already have the SharePoint Online Management Shell installed, by open running PowerShell as an administrator.

  1. From the start menu, search for PowerShell and ‘Run ISE as Administrator’
  • In the window that opens, paste the below and hit the green play button

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

  • To then install the latest version, paste the below line and hit the green play button

Install-Module -Name Microsoft.Online.SharePoint.PowerShell

  • In the pop-up window that appears, select ‘Yes to All’ and wait for the installation to finish. If you already have the latest version, a message will tell you so.

Now that PnP has successfully been installed, you can start to remotely administer our tenant.

How to connect to your tenant with PnP PowerShell

It only takes one cmdlet to connect to your tenant with PnP PowerShell.

  1. In the PowerShell window paste the below, replacing the bold caps with your tenant domain and your 365 username and hit the green play button:

Connect-SPOService -Url https://YOURTENANT-admin.sharepoint.com -Credential LOGIN@DOMAIN.com

  • Enter your password in the pop-up window that appears.

If you tenant use multi factor authentication, you can use the below cmdlet and enter your credentials in the pop-up window that appears.

 Connect-SPOService -Url https://YOURTENANT-admin.sharepoint.com

And that’s it. You’ve now installed PnP PowerShell and connected to you Microsoft 365 tenant. In the next post, we’ll look at executing some of the most common cmdlets for SharePoint Online.

No Responses

Leave a Reply

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