【问题标题】:PSSnapin Microsoft.Sharepoint.Powershell is not installed on this computer此计算机上未安装 PSSnapin Microsoft.Sharepoint.Powershell
【发布时间】:2019-10-01 20:29:47
【问题描述】:

当我尝试在 SharePoint Online 命令行管理程序中运行命令 Add-PSSnapin Microsoft.SharePoint.Powershell

我收到以下错误:

Add-PSSnapin : The Windows PowerShell snap-in 'Microsoft.SharePoint.Powershell` is not installed on this computer

+ CategoryInfo: InvalidArgument: (Microsoft.SharePoint.Powershell:string) [Add-PSSnapin], PSArgumentException

据我了解,无论如何它都应该随 SharePoint Online 命令行管理程序一起安装(这是一个全新的下载),所以它为什么不让我安装它

我可以使用 $AdminURL、$AdminName 和 $Password 登录 Sharepoint,所以这不是世界末日(并证明这应该有效),但显然会使脚本不太容易跨站点运行,因为它必须每次修改url和adminname

编辑:我在另一篇文章中读到,添加此模块(不是 snapin)将解决我的错误问题 Get-SPSite is not recognized as the name of a cmdlet, function, script file, or operable programGet-SPWebApplication is not recognized as the name of a cmdlet, function, script file, or operable program 但是,这并没有解决我的问题......

【问题讨论】:

  • 43997587 的可能重复项。你能运行Connect-SPOService 吗?根据另一个线程,它是一个模块,而不是一个管理单元,所以它不需要像这样加载。
  • Install-Module -Name Microsoft.Online.SharePoint.PowerShell Powershell 应该在提升模式下运行(以管理员身份) 据我所知,微软决定放弃管理单元。只要模块位于$env:psmodulePath 路径之一中,当您使用模块中的任何命令时,模块将自动导入。
  • @jblaupunkt 尝试使用get-module -listavailable 查找Sharepoint 模块并尝试import-module <SharePpoint modulename> 或使用get-command "Get-SPWebApplication" 检查它所在的模块并导入该模块
  • @jblaupunkt 您是在尝试访问本地 SharePoint 服务器,还是在线访问?因为您尝试使用的命令 Get-SPSiteGet-SPWebApplication 旨在与 Sharepoint Server 一起使用。
  • @jblaupunkt 是的,这应该可以解决问题。

标签: powershell sharepoint office365


【解决方案1】:

正如用户 @kuzimoto 所提到的,我使用的命令与 SharePoint Online 不兼容,旨在与 SharePoint Server 结合使用。

正确的连接方法是使用命令Connect-SPOService 并通过那里传递凭据,或者只是将它们硬编码到您的脚本中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-15
    • 2013-04-09
    • 1970-01-01
    • 1970-01-01
    • 2012-04-05
    • 2011-03-10
    相关资源
    最近更新 更多