【发布时间】:2021-02-26 14:26:08
【问题描述】:
我有一个任务:使用 Azure DevOps Pipelines 在远程机器上安装解决方案 (wsp)。
我有带有 *.wsp 的文件夹。我有一个 PS 脚本。如果我在这台机器上手动操作,它工作正常。没有错误。
但是当我使用 Azure DevOps 时,我收到一条消息:
Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 5.
At C:\Windows\SysWOW64\WindowsPowerShell\v1.0\profile.ps1:1 char:1
+ Add-PSSnapin "Microsoft.SharePoint.Powershell"
在我的 PS 脚本的最开始,我有这个:
Add-PSSnapin "Microsoft.SharePoint.Powershell"
我需要它,因为我在脚本中使用了 Uninstall-SPSolution、Remove-SPSolution、Add-SPSolution 和 Install-SPSolution cmdlet。
我已经尝试添加
Add-PSSnapin "Microsoft.SharePoint.Powershell"
到“profile.ps1”,我尝试在 powershell 中运行 powershell。一次又一次的错误是一样的。我不明白如何解决它。
https://i.stack.imgur.com/UNM7R.png
https://i.stack.imgur.com/NTiWs.png
https://i.stack.imgur.com/sA6tU.png
https://i.stack.imgur.com/bK9kq.png
【问题讨论】:
-
能否提供管道中 PowerShell 步骤和 PowerShell 脚本开头的屏幕截图?
-
附上图片。