SharePoint PnP logo

How to solve errors about missing PnP Cmdlets on PowerShell

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).

Symptoms

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!ย 

Reason

Usually, it’s simple enough. You don’t have the cmdlets installed, or sometimes you might have multiple, conflicting ones. 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 is usually at least a simple fix. Run the following cmdlet:

Install-Module SharePointPnPPowerShellOnline

This works in Windows 10, or if you have PowerShellGet installed.

For more information, check this page out:

https://github.com/SharePoint/PnP-PowerShell

The following two tabs change content below.

Antti K. Koskela

Solutions Architect / Escalations Engineer at Koskila / Norppandalotti Software / Valo Solutions
Antti Koskela is a proud digital native nomadic millenial full stack developer (is that enough funny buzzwords? That's definitely enough funny buzzwords!), who works as a Solutions Architect for Valo Intranet, the product that will make you fall in love with your intranet. Working with the global partner network, he's responsible for the success of Valo deployments happening all around the world. 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.

Let me know your thoughts!