Connect-PnPOnline : The term 'Connect-PnPOnline' is not recognized as the name of a cmdlet, function, script file, or operable program
Solution 1
Please install the Pnp PowerShell assembly in your system from here:
And then consume in SharePoint Online Management Shell: Connect-PnPOnline –Url https://tenant.sharepoint.com –Credentials (Get-Credential)
It will pop up a credential window, input credential and then continue:
Solution 2
If the machine has Internet access and you're on PowerShell 6 or later, it's actually easier to use PowerShell-Get by running:
Install-Module SharepointPNPPowershellOnline
Note: PowerShellGet is available for earlier PowerShell versions as well, but needs to be installed first - see here.
john Gu
Updated on June 04, 2022Comments
-
john Gu almost 2 years
I have windows 7 64-bit , and i have install sharepoint management shell from this link https://www.microsoft.com/en-us/download/details.aspx?id=35588.
but when i open the SP management shell and i try to run this command:-
PS C:\> Connect-PnPOnline https://*****.sharepoint.com/sites/***/
I got this error:-
Connect-PnPOnline : 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. At line:1 char:1 + Connect-PnPOnline + ~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Connect-PnPOnline:String) [], C ommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
so not sure what i am missing?
Here is my version table:-
PS C:\> $psversiontable Name Value ---- ----- PSVersion 3.0 WSManStackVersion 3.0 SerializationVersion 1.1.0.1 CLRVersion 4.0.30319.42000 BuildVersion 6.2.9200.22198 PSCompatibleVersions {1.0, 2.0, 3.0} PSRemotingProtocolVersion 2.2
-
jrider about 6 yearsHave you ran the install-module ?
-
john Gu about 6 years@jrider trying to run this command will raise this error
Install-Module : The term 'Install-Module' 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. At line:1 char:1
-
jrider about 6 yearsAfter further reading of the documentation (initial comment) there is an alternate installation for lower versions of powershell. However, it does mention you major version (
$PSVersionTable.PSVersion
) should be above 3 (You might need to update). In short, it says you can run this to install the module:Invoke-Expression (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/sharepoint/PnP-PowerShell/master/Samples/Modules.Install/Install-SharePointPnPPowerShell.ps1')
-
john Gu about 6 years@jrider this will try to install a software named package managemnt.. i am not sure if i should trust this
-
jrider about 6 yearsThis documentation is from Microsoft (I would trust it). If you don't feel comfortable with it. Your only other alternative is to update your PowerShell version.
-
john Gu about 6 years@jrider now i run the above script as you mentioned
Invoke-Expression (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/sharepoint/PnP-PowerShell/master/Samples/Modules.Install/Install-SharePointPnPPowerShell.ps1')
then i restarted my PC,, but when i try to runInstall-Module SharePointPnPPowerShellOnline
.. i got the following errorInstall-Module : The 'Install-Module' command was found in the module 'PowerShellGet', but the module could not be loaded. For more information, run 'Import-Module PowerShellGet'. At line:1 char:1
-
john Gu about 6 years. now i am running sharepoint online so is the script you mentioned targetting it ?
-
jrider about 6 years
Install-Module
does not work in your version of powershell. Try running yourConnect-PnpOnline
again -
john Gu about 6 years@jrider also
$PSVersionTable
is showing the same values .. should this got updated after the installation link you send? -
john Gu about 6 years@jrider i am getting this now
Connect-PnPOnline : 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.
-
jrider about 6 yearsThis did not update powershell. This is just a way to get the module installed (per the documentation). Check to see if you have the module installed by running
Get-Module SharePointPnPPowerShell* -ListAvailable | Select-Object Name,Version | Sort-Object Version -Descending
-
jrider about 6 yearsLet us continue this discussion in chat.
-
jrider about 6 yearsI'm moving this to chat. It is getting rather extensive
-
-
TG2 almost 5 yearsSeem to be seeing this type of problem: github.com/SharePoint/PnP-PowerShell/issues/1340 "Connect-PnPOnline : A parameter cannot be found that matches parameter name 'Scopes'"