It’s not often that I work with SharePoint on-premises anymore, but recently I had a look at PnP PowerShell for SharePoint 2013. Office 365 - Office Dev PnP PowerShell - Mixing up releasesToday I switched back to SharePoint Online, mixing up the releases for the different platforms. I started to export some sites using get-PnPProvisioningTemplate and I got the following error message:
powershell_ise.exe Information: 0 : 2017-03-20 14:55:48.3702 [Page Contents] [12] [Debug] Code execution scope started 0ms b4990d80-e2e7-43cb-a4d8-d73c0d5a4b8b powershell_ise.exe Information: 0 : 2017-03-20 14:56:06.5870 [Page Contents] [12] [Debug] Code execution scope ended 18216ms b4990d80-e2e7-43cb-a4d8-d73c0d5a4b8b powershell_ise.exe Information: 0 : 2017-03-20 14:56:06.5895 [Extraction] [12] [Debug] Code execution scope ended 48910ms b4990d80-e2e7-43cb-a4d8-d73c0d5a4b8b Get-PnPProvisioningTemplate : The remote server returned an error: (403) Forbidden. At C:\Workspace\Triad PnP Framework\Triad.FrameWork\Triad.FrameWork.Provisioning\Modules\TriadModules\Modules\Triad.PowerShell.PnPTemplates\Triad.PowerShell.PnPTemplates.psm1:77 char:21 + … Get-PnPProvisioningTemplate -Web $web -Out “$path\Templat … + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : WriteError: (:) [Get-PnPProvisioningTemplate], WebException + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Provisioning.GetProvisioningTemplate
The nice thing about PnP PowerShell is that you can interchange the templates or at least almost between the on-premises versions of SharePoint and SharePoint Online.As I worked with SharePoint 2013 recently I installed the 2013 version of PnP PowerShell and of course today I didn’t install the Online version of PnP PowerShell.Once I got the right version of PnP installed the error message disappeared.So how do you check  version you have installed?Within your PowerShell window run
Get-Module
Then all modules loaded will be listed.Office 365 - Office Dev PnP PowerShell - Mixing up releasesIf you work with SharePoint online you should make sure that you have the following included in the results:
Binary     2.13.17… SharePointPnPPowerShellOnline       {Add-PnPContentType, Add-PnPContentTypeToDocumentSet, Add-PnPContentTypeToList, Add-PnPCustomAction…}

Frequently asked questions

What caused the 403 error in the author’s test?

The author had installed a SharePoint 2013 PnP PowerShell release while working against SharePoint Online; installing the matching Online release resolved that particular case.

How did the article inspect loaded modules?

It used Get-Module in PowerShell to list loaded modules and check which PnP release was present.

Does every 403 error mean the wrong module is installed?

No. This was one historical cause; also investigate authentication and permissions, and use current PnP PowerShell documentation.

Is your business still running on paper trails, sprawling Excel files, or ageing Access databases? There's a better way — and I can show you exactly what it looks like. I'm the Technical Director of Vantage 365, a Microsoft solutions consultancy working with clients across the UK, the Netherlands, and worldwide. For over 30 years I've been turning messy, manual business processes into clean, automated systems that save time, reduce errors, and give teams the visibility they need to make better decisions. SharePains is not just any blog run by a Microsoft MVP. Have you ever used Try-Catch in Power Automate? The original post about Try-Catch in Power Automate can still be found on this site, https://sharepains.com/2018/02/07/try-catch-finally-in-power-automate-flow/ Or have you ever used the Pieter’s method to avoid variables and speed up your flows? https://sharepains.com/2020/03/11/pieters-method-for-advanced-in-flows/ You can contact me using contact@sharepains.com

Related Posts

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

×