【问题标题】:Powershell Start-Process ignored in remote session远程会话中忽略 Powershell 启动进程
【发布时间】:2013-02-22 15:38:19
【问题描述】:

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

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

这在本地运行时工作正常,但在远程会话中运行时,该语句将被忽略。

我也尝试将命令移动到单独的文件,但这没有区别。

$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

有什么建议吗?

【问题讨论】:

    标签: sharepoint powershell deployment invoke-command start-process


    【解决方案1】:

    您可能会在第二个跃点的远程会话中遇到权限问题(在您的情况下是已启动进程的权限)。 请参阅启用 credssp http://ss64.com/ps/enable-wsmancredssp.html

    【讨论】:

    • 远程调用本身已启动,并且在 Start-Process 之前和之后的所有操作都运行良好。只是 Start-Process 似乎被忽略了。
    • 远程调用本身,以及在该会话中运行的命令是“第一跳”。
    • 如果第二个进程在同一台机器上启动,是否算作“第二跳”?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多