【问题标题】:Connect-PnPOnline : The term 'Connect-PnPOnline' is not recognized as the name of a cmdlet, function, script file, or operable programConnect-PnPOnline:术语“Connect-PnPOnline”未被识别为 cmdlet、函数、脚本文件或可运行程序的名称
【发布时间】:2018-10-08 10:52:24
【问题描述】:

我有 windows 7 64 位,我已经从这个链接https://www.microsoft.com/en-us/download/details.aspx?id=35588 安装了共享点管理外壳。

但是当我打开 SP 管理 shell 并尝试运行此命令时:-

PS C:\> Connect-PnPOnline https://*****.sharepoint.com/sites/***/

我收到了这个错误:-

Connect-PnPOnline:术语“Connect-PnPOnline”未被识别为 cmdlet、函数、脚本文件或可运行程序的名称。 检查名称的拼写,或者如果包含路径,请验证 路径正确,然后重试。在行:1 字符:1 + 连接-PnPOnline + ~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Connect-PnPOnline:String) [], C ommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

所以不确定我错过了什么?

这是我的版本表:-

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

【问题讨论】:

  • 你跑过install-module 吗?
  • @jrider 尝试运行此命令将引发此错误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
  • 在进一步阅读文档(初始评论)后,可以使用较低版本的 powershell 替代安装。但是,它确实提到您的主要版本 ($PSVersionTable.PSVersion) 应该高于 3(您可能需要更新)。简而言之,它说您可以运行它来安装模块:Invoke-Expression (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/sharepoint/PnP-PowerShell/master/Samples/Modules.Install/Install-SharePointPnPPowerShell.ps1')
  • @jrider 这将尝试安装一个名为 package managemnt 的软件。我不确定我是否应该相信这个
  • 本文档来自 Microsoft(我相信它)。如果你觉得不舒服。您唯一的其他选择是更新您的 PowerShell 版本。

标签: powershell cmd sharepoint-online


【解决方案1】:

请从此处在您的系统中安装 Pnp PowerShell 程序集:

SharePoint/PnP-PowerShell

然后在 SharePoint Online 命令行管理程序中使用: Connect-PnPOnline –Url https://tenant.sharepoint.com –Credentials (Get-Credential)

会弹出一个凭证窗口,输入凭证然后继续:

【讨论】:

【解决方案2】:

如果机器可以访问 Internet,并且您使用的是 PowerShell 6 或更高版本,则通过运行来使用 PowerShell-Get 实际上更容易:

Install-Module SharepointPNPPowershellOnline

注意:PowerShellGet 也可用于早期的 PowerShell 版本,但需要先安装 - 请参阅 here。

【讨论】:

    猜你喜欢
    • 2019-10-07
    • 2021-11-01
    • 2021-05-23
    • 2020-11-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多