This post was most recently updated on November 25th, 2018.Reading Time: 3 minutes.
This blog posts briefly describes how to solve some of the most typical errors about missing PnP Cmdlets when using Windows Powershell (or SharePoint Online Management Shell).
When trying to run some PnP-related cmdlet, you get an error similar to ones below:
Connect-PnPOnline : The term 'Connect-PnPOnline' is not recognized as the name of a cmdlet, function, script file, or o perable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try aga in. At C:\Users\koskela\Downloads\Import-Valo-With-Content\Import\New-Valo.ps1:46 char:5 + Connect-PnPOnline -Url $AdminUrl + ~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Connect-PnPOnline:String) , CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
Get-PnPTenantSite : The term 'Get-PnPTenantSite' is not recognized as the name of a cmdlet, function, script file, or o perable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try aga in. At C:\Users\koskela\Downloads\Import-Valo-With-Content\Import\New-Valo.ps1:51 char:23 + $SiteCollection = Get-PnPTenantSite -Url $Url -ErrorAction Silent ... + ~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Get-PnPTenantSite:String) , CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
New-PnPTenantSite : The term 'New-PnPTenantSite' is not recognized as the name of a cmdlet, function, script file, or o perable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try aga in. At C:\Users\koskela\Downloads\Import-Valo-With-Content\Import\New-Valo.ps1:60 char:7 + New-PnPTenantSite -Title $Configuration.SiteCollection.Title ` + ~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (New-PnPTenantSite:String) , CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
Usually, this is luckily a simple fix!
Usually, it’s simple enough. You don’t have the cmdlets installed, or sometimes you might have multiple, conflicting ones. Let’s get rid of the old ones, and just go with the latest one!
In the examples below, “SharePointPnPPowerShellOnline” refers to the SharePoint Online version of the PnP commandlets, but you can replace “Online” in the module name with “2013”, “2016” or “2019” to use different SharePoint Server (On-Premises) versions of the commandlets instead!
In any case, the code below will go through your modules and show you, which versions you might have. See the example output below as well:
Get-Module SharePointPnpPowerShellOnline -ListAvailable | select Name,Version
If you’ve got a few, get rid of them with this before continuing with the solution:
Remove-Module -name SharePointPnPPowerShellOnline
Solution: (re)install the PnP-cmdlets
This usually fixes any basic, run-of-the-mill issues with these commandlets. It’s often a good idea to rule out the version conflicts or old versions of the commandlets before trying to figure it anything else. Run the following:
This works in Windows 10, or if you have PowerShellGet installed.
For more information, check this page out: https://github.com/SharePoint/PnP-PowerShell
He's been a developer from 2004 (starting with PHP and Java), and he's been bending and twisting SharePoint into different shapes since MOSS. Nowadays he's not only working on SharePoint, but also on .NET projects, Azure, Office 365 and a lot of other stuff.
This is his personal professional (e.g. professional, but definitely personal) blog.
Latest posts by Antti K. Koskela (see all)
- Failed to load component. Original error: ***Failed to load path dependency ContosoSPFxWebPartLocalization from component [guid] (ContosoSPFxWebPart). - May 15, 2019
- How to resolve “You cannot edit this page”-error in Modern SharePoint - May 6, 2019
- “Connecting to site failed: ‘.’, hexadecimal value 0x00, is an invalid character.”, when trying to connect to SharePoint Online - May 2, 2019