为 Microsoft SharePoint 添加 powerShell 管理单元时出错

Error when adding powerShell snapins for Microsoft SharePoint

我有 SharePoint PowerShell 脚本,我需要在 PowerShell v5.0

上本地 运行

我尝试执行 Add-PSSnapin "Microsoft.SharePoint.PowerShell" 但它抛出错误:

The Windows PowerShell snap-in 'Microsoft.SharePoint.PowerShell' is not installed on this computer.

如何下载这些 dll 并安装管理单元?

您必须将 RDP 连接到 SharePoint 服务器本身,或者使用 PSSession 通过 PowerShell 连接到服务器,如下所示:

New-PSSession -ComputerName SP2013Server
Add-PSSnapin Microsoft.SharePoint.Powershell

要执行此操作PSRemoting 需要在服务器上启用

我不知道是否是这种情况,但是当我错误地 运行 在 powershell ISE(x86) 而不是 64 位版本上运行脚本时,我收到了这条错误消息。