9

Currently I'm using this git hub article.

I'm using this for SharePoint online. So I have installed SharePointPnPPowerShellOnline.msi from this.

After that I have try to run script Enable-SPResponsiveUI.ps1. But It will show

error:

The term 'Connect-PnPOnline' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

7
  • What is you PowerShell version? Check by running $PSVersionTable Commented Jan 4, 2017 at 7:42
  • Name Value ---- ----- PSVersion 3.0 WSManStackVersion 3.0 SerializationVersion 1.1.0.1 CLRVersion 4.0.30319.17929 BuildVersion 6.2.9200.16384 PSCompatibleVersions {1.0, 2.0, 3.0} PSRemotingProtocolVersion 2.2 Commented Jan 4, 2017 at 8:28
  • 4
    Just Found solution here sharepoint.stackexchange.com/questions/199756/… By running Install-Module SharePointPnPPowerShellOnline Thanks Commented Jan 4, 2017 at 8:29
  • It works fine but show another error like "Apply-PnPProvisioningTemplate : Value cannot be null" Commented Jan 4, 2017 at 8:33
  • Value cannot be null that's another story...something wrong with pnp provisioning.. Ideally stacktrace might help a log Commented Jan 4, 2017 at 8:52

2 Answers 2

14

There are multiple ways to install the PnP cmdlets. As you discovered in your comment the tools can be installed "...By running Install-Module SharePointPnPPowerShellOnline" which is what Microsoft recommends1. It's possible the other option you tried with the .msi file failed because there was an open instance of PowerShell that needed restarting?

Installation options

1. Install from PowerShell Gallery

If you main OS is Windows 10, or if you have PowerShellGet installed, you can run the following commands to install the PowerShell cmdlets:

  • SharePoint Online: Install-Module SharePointPnPPowerShellOnline
  • SharePoint 2016: Install-Module SharePointPnPPowerShell2016
  • SharePoint 2013: Install-Module SharePointPnPPowerShell2013

2. Install from setup files

You can download setup files from the releases section of the PnP PowerShell repository. These files will up be updated on a monthly basis. Run the install and restart any open instances of PowerShell to use the cmdlets.

3. Using an installation script

This is an alternative for installation on machines that have at least PowerShell v3 installed. You can find the version of PowerShell by opening PowerShell and running $PSVersionTable.PSVersion. The value for Major should be above 3.

To install the cmdlets you can run the below command which will install PowerShell Package Management and then install the PowerShell Modules from the PowerShell Gallery.

Invoke-Expression (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/sharepoint/PnP-PowerShell/master/Samples/Modules.Install/Install-SharePointPnPPowerShell.ps1')

Footnotes

  1. Microsoft Docs, PnP PowerShell overview, Installation "We recommend, where possible, to install them from the PowerShell Gallery."
2
  • 1
    If you don't have local admin access to the computer you can add "-Scope CurrentUser" to get it installed as well. Install-Module SharePointPnPPowerShellOnline -Scope CurrentUser
    – mojoriesen
    Commented Feb 20, 2020 at 18:51
  • 2
    Just as an update, the Online library in this answer is legacy. Instead, run: Install-Module -Name PnP.PowerShell
    – pwmusic
    Commented Apr 25, 2023 at 16:22
0

The PnPOnline package is installed to the user profile only by default. So if you are logged into the server with your account, and install PnPonline, then run the PowerShell window under the SharePoint farm account, you will get the above error. You have to log in as the farm account and install the PnPOnline package under that account.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.