Skip Ribbon Commands
Skip to main content

Quick Launch

Todd Klindt's home page > Todd Klindt's Office 365 Admin Blog > Posts > Making the move from SharePointPnPPowerShellOnline to PnP.PowerShell
December 28
Making the move from SharePointPnPPowerShellOnline to PnP.PowerShell

As the new year approaches I find myself making changes. Like everyone on the planet I plan to eat less and exercise more. I also plan on making another change, I’ll be moving away from my friend the venerable old SharePointPnPPowerShellOnline module to the new, sexier PnP.PowerShell. I thought I’d blog the experience so you all can follow along.

Why the Move?

The SharePointPnPPowerShellOnline module has been good to me over the last few years. It has helped me do amazing things both in PowerShell and in SharePoint. Why would I ever give that all up? Because the times, they are a-changing. The SharePointPnPPowerShellOnline module is being retired and all of that effort is being channeled to the PnP.PowerShell module. The SharePointPnPPowerShellOnline module will continue to be around for the on-prem versions of SharePoint Server (though not updated), but for SharePoint Online/Office 365/Microsoft 365 you’ll need to use the PnP.PowerShell module.

Why did the PnP team decide this? You can get the whole story at the official PnP PowerShell page, but there are two main reasons. The first is wider platform support. SharePointPnPPowerShellOnline had .NET dependencies that meant it would only run on Windows PowerShell. Emphasis on Windows. When that module was first created 6 years ago that made perfect sense, but since then PowerShell has gone open source and now runs on a variety of platforms like Mac, Linux, a variety toasters, etc. Since SharePointPnPPowerShellOnline required Windows it couldn’t follow PowerShell onto those other platforms. The PnP.PowerShell module was written without those Windows dependencies so it can run anywhere PowerShell can run. You may not use a Mac, but this also means that you can use PnP.PowerShell more easily in cloud environments like Azure Functions.

The second reason was to give wider application support. The SharePointPnPPowerShellOnline mostly supported SharePoint, as the name would suggest. These days you can’t manage SharePoint Online without also needing to touch Microsoft Groups, Teams, etc. The PnP added more and more cmdlets to handle that, but there were some big authentication changes that needed to be made to fully support all of the other applications. They started adding some of that to SharePointPnPPowerShellOnline, but it was cobbled together a bit. While they were refactoring the module for .NET Standard they went ahead and made some sweeping authentication changes that mean we’ll be able to use it more easily for SharePoint and all of the other applications we know and love.

First Step PowerShell 7

The first step to moving to the PnP.PowerShell module is to install PowerShell 7, also called PowerShell Core. I’m on Windows, so that’s the process I’m going to walk through. Windows comes with PowerShell, Windows PowerShell 5.1. To use PowerShell 7 we’ll have to install it. Windows PowerShell 5.1 and PowerShell Core 7 can happily coexist on your machine, so you don’t have to worry about breaking any of your other existing PowerShell scripts or tools.

image

You can see from this screenshot I have both versions of PowerShell installed and running on this machine. You can use the system variable $PSVersionTable to see which version of PowerShell your host is currently using. It’s also pretty easy to pick the version of PowerShell you want when firing it up.

image

While PowerShell 7.x can coexist with Windows PowerShell 5.x, it will replace PowerShell 6.x if you have that installed.

I installed PowerShell 7 by downloading the installation MSI from the GitHub page. For me that was the Windows x64 platform and I grabbed the stable build. That file was PowerShell-7.1.0-win-x64.msi, but obviously that filename will change as PowerShell 7 advances. Then I popped open a Windows PowerShell 5 (oh, the irony) prompt in Admin mode and ran the MSI.

image

The friendly wizard walked me through the process. There are few installation choices to make, but I’ve found the defaults are usually fine.

After the installation is finished you’ll have both Windows PowerShell 5.x and PowerShell Core 7.x. Time to install some modules.

The Module

Installing the PnP.PowerShell module is pretty easy, but if you have the older SharePointPnPPowerShellOnline module installed you’ll need to uninstall it first. The cmdlet names in both modules are the same, So PnP.PowerShell won’t install all of its cmdlets while there are collisions with the old version. To uninstall the SharePointPnPPowerShellOnline module open up a Windows PowerShell 5 host in Admin mode and enter this:

Uninstall-Module SharePointPnPPowerShellOnline –AllVersions

and wave a fond farewell to our old friend. After that’s finished, and you’re done sobbing, open up a shiny new PowerShell Core 7 host in Admin mode. While you’re in there opening up in Admin mode, go ahead and add PowerShell 7 to your Start Menu and your Taskbar. You’ll thank me later.

image

Then issue this command:

Install-Module PnP.PowerShell –AllowPrerelease

image

You’re all done. Since PnP.PowerShell is not an official release yet you’ll need the scary sounding –AllowPrerelease parameter. After January of 2021 you won’t need that anymore.

Finally, Authentication

I mentioned earlier that one of the reasons for changing modules was a change in authentication. I don’t want to get too deep into it in this blog post but I do want to mention that you should run Register-PnPManagementShellAccess to set up a an Azure Application Registration. This is the magic that allows the new PnP PowerShell access to all of the applications in Office 365. You may have seen this referred to as Graph API. I’ll dig into it later, but for now all you need to know is that a tenant admin needs to run the PnP.PowerShell version of Register-PnPManagementShellAccess once in your tenant. After that is in place you should be able to use Connect-PnPOnline and get connected.

tk

ShortURL: https://www.toddklindt.com/NewPnPPowerShell

Comments

Re: Making the move from SharePointPnPPowerShellOnline to PnP.PowerShell

Montreal Auto Recyclage offers cash for cars montreal in longueuii http://montrealautorecyclage.ca/cash-for-cars-montreal-in-longueuil/, providing instant cash for your vehicles. Explore our efficient process and unlock the value of your cars today.
 on 10/3/2023 8:45 AM

Re: Making the move from SharePointPnPPowerShellOnline to PnP.PowerShell

At D&M Discount Realty, we have a team of highly skilled and experienced Best real estate agents in Cedar City https://cedarcityrealestate.com/ market. Our agents are not only knowledgeable about the area's real estate trends but also have a deep understanding of the local communities. Whether you are buying or selling, our agents will work tirelessly to ensure a smooth and successful transaction.
 on 10/11/2023 8:01 AM

Re: Making the move from SharePointPnPPowerShellOnline to PnP.PowerShell

Discover the BestGarage Flooring and Lighting https://garagesandworkshops.com/ Solutions at Garages & WorkShops. Explore our expert reviews to enhance your workspace. Click here to explore more.
 on 10/11/2023 8:44 AM

Re: Making the move from SharePointPnPPowerShellOnline to PnP.PowerShell

Uncover the secrets of Buenos Aires with DulceLuxuria. Click here to explore more https://www.dulceluxuria.com/en/argentina-escort/ escorts Argentina, putas VIP, and escorts CABA, offering a world of sophistication.
 on 10/14/2023 8:43 AM

Re: Making the move from SharePointPnPPowerShellOnline to PnP.PowerShell

The Art of Timekeeping at Your Fingertips - Top Watches, where every tick and tock comes to life. Learn more about your favorite timepieces at https://topwatches.com/ https://topwatches.com/
 on 10/16/2023 5:48 AM

Re: Making the move from SharePointPnPPowerShellOnline to PnP.PowerShell

Laptop loan made easy in Singapore! Rent Laptops for events https://www.classroomforrent.net/laptop-rental-singapore/ or short-term use starting at $30 a day. Explore our options and enjoy hassle-free rentals.
 on 10/16/2023 6:00 AM

Re: Making the move from SharePointPnPPowerShellOnline to PnP.PowerShell

Are you ready to embark on a journey in the Queen Creek realtors, AZ real estate market? Look no further, because top Realtor Gary Wales is your guiding light in this exciting venture. With years of experience and a deep understanding of the Queen.Queen Creek realtors https://tawk.to/9ffc673f4435c3b9ca48186ea9c0a3106a5f36e7
 on 10/18/2023 3:52 AM

XDGDRFEH

Looking for a Financial Advisor near you in Ottawa? Been There Financial Planning is your go-to destination. Led by accredited financial advisor William Rychliwsky, we provide commission-free financial planning and help you achieve your goals. From retirement planning to managing financial risks, we offer comprehensive services tailored to your unique situation.visit us https://www.beentherefinancial.com/
 on 10/21/2023 8:06 AM

XDGDRFEH

For ranches for sale in Texas Hill Country, visit our website. Find your perfect piece of paradise among Kerrville farms and more. Click here to begin.ranches for sale in texas https://www.tripadvisor.in/Profile/250hillc
 on 10/22/2023 4:46 AM

Re: Making the move from SharePointPnPPowerShellOnline to PnP.PowerShell

Ones own favorite songs is without a doubt astonishing. You have got various highly athletic animators. As i intend one the ideal in achieving success.rivershop https://rivershop.website
 on 10/25/2023 8:41 AM
1 - 10Next

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Title


Body *


Today's date *

Select a date from the calendar.
Please enter today's date so I know you are a real person

Twitter


Want a message when I reply to your comment? Put your Twitter handle here.

Attachments

 

 SysKit