我正在使用以下方式开始一个新流程:
$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
有什么建议吗?
答案 0 :(得分:1)
第二跳的远程会话中的权限可能会出现问题(在您的情况下,已启动进程的权限)。 请参阅启用credssp http://ss64.com/ps/enable-wsmancredssp.html