当我尝试Add-PSSnapin Microsoft.SharePoint.Powershell
在 SharePoint Online 命令行管理程序中运行命令时
我收到以下错误:
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 Management Shell 一起安装(这是一个全新的下载),所以为什么不让我安装它
我可以使用 $AdminURL、$AdminName 和 $Password 登录到 Sharepoint,所以这不是世界末日(并证明这应该可行),但显然使脚本不太容易跨站点运行,因为它必须每次都修改更改 url 和 adminname
编辑:我在另一篇文章中读到,添加这个模块(不是 snapin)可以解决我的错误问题Get-SPSite is not recognized as the name of a cmdlet, function, script file, or operable program
,Get-SPWebApplication is not recognized as the name of a cmdlet, function, script file, or operable program
但是,这并没有解决我的问题......