[英]PowerShell Script or Typescript for hiding default WebParts from a modern team site
[英]Remote Execution from Powershell Script called from Team Foundation Build
我正在尝试使用sharepoint脚本部署sharepoint解决方案,使用以下方法:
首先,我使用Windows PowerShell控制台测试环境
New-PSSession -ComputerName developmentserver01
Enter-PSSession -computername developmentserver01
d:
cd d:\deploymentscripts
.\deploysharepoint.ps1
然后我开始自动化:
1.- TFS运行一个构建,在构建服务器本地调用“deploy.ps1”。 --->这是有效的。
2.- desploy1.ps1将drop文件复制到开发环境developmentserver01共享文件夹。
3.-复制文件后,使用来自powershell的远程连接命令将deploy1.ps1 connet与开发环境机器developmentserver01连接 - >这是有效的。
4.-此步骤失败,在此步骤中,我尝试执行已在步骤2中在开发环境机器中复制的部署脚本deploySharepoint.ps1。首先在PowerShell控制台中使用脚本内的命令,但我看到命令在TFS构建机器内运行,而不是在我连接的远程连接机器上运行
d:
cd d:\deploymentscripts
.\deploysharepoint.ps1
稍后使用不同的选项(invoke-command,...)只有这个optionk工作:
Invoke-Command -computername developmentserver01 -scriptblock{d:\DeploymentScripts\deploysharepoint.ps1 -solutionNames @("parameter1")}
问题在于我认为invoke-command不像使用powershell控制台的命令那样工作,因为脚本显示用户没有访问Sharepoint的权限的错误。
如果我在电源shell控制台中运行带有远程会话的脚本,如帖子开头所示,一切正常。
如何使用来自脚本desploy.ps1的远程会话运行远程脚本deploysharepoint.ps1,就像使用powershell控制台一样?
invoke-command
是正确的答案。 但:
该脚本显示用户没有访问Share of Farm的权限的错误。
如果TFS Build的用户帐户(本地或远程)调用3脚本,则该帐户用于确定权限。
因此,要么将用于运行构建的帐户更改为具有正确SharePoint权限的帐户,要么为TFS构建帐户授予必要的权限。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.