sharepoint - Powershell 启动进程在远程 session 中被忽略

标签 sharepoint powershell deployment invoke-command start-process

我正在使用以下方法开始一个新流程:

$removeArguments = "-Command  `"&{import-module .\deploy-utility.psm1; RemoveSolutions -solutionNames $solutionNames -url $url;}`""
start-process powershell -ArgumentList $removeArguments -Wait

这在本地运行时工作正常,但在远程 session 中运行时,该语句被简单地忽略。

我也尝试将命令移动到一个单独的文件,但这没有区别。
$removeArguments = "-File .\deploy-utility-functions.ps1", "remove", "$solutionNames", "$url"
$script = {start-process powershell -ArgumentList $removeArguments -Wait -NoNewWindow | Out-Host}
Invoke-Command -ScriptBlock $script

远程调用:
$script = [scriptblock]::create("& '.\$targetFile' '$arguments'")
$result = Invoke-Command -Session $s -ScriptBlock $script

有什么建议?

最佳答案

您可能会在第二跳的远程 session 中遇到权限问题(在您的情况下为已启动进程的权限)。
查看启用 credssp http://ss64.com/ps/enable-wsmancredssp.html

关于sharepoint - Powershell 启动进程在远程 session 中被忽略,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15027756/

相关文章:

java - Android:下载受 NTLM 身份验证保护的文件

c# - Directory.GetFiles 不返回任何文件......有时

powershell - 在服务名称带有破折号的地方使用Get-Service

powershell - 使用 Jenkins 将 war 文件部署到 Tomcat 的推荐方法?

tomcat - 亚马逊AWS和tomcat不间断(优雅)部署

jquery - 需要以编程方式将共享点字段设置为必填字段

c# - 如何从任务的“分配给”字段获取 SPuser 对象

powershell - PowerShell Office 365脚本可同时获取用户和邮箱信息

powershell - 组合两个 PowerShell do..while 语句

azure - 在 Azure 应用服务上部署 FastAPI 和 uvicorn