1
votes

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
2
Have you ran the install-module ? - jrider
@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 - john Gu
After 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') - jrider
@jrider this will try to install a software named package managemnt.. i am not sure if i should trust this - john Gu
This 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. - jrider

2 Answers

4
votes

Please install the Pnp PowerShell assembly in your system from here:

SharePoint/PnP-PowerShell

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: enter image description here

2
votes

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.