Powershell InvokeCommand取消连接会话超时?

2024-06-26 13:55:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用powershell从远程计算机运行python脚本。我使用的是-unconnectedsession参数,但我认为它会强制超时2小时?当我使用命令行从远程计算机中运行python脚本时,它不会超时。有人能解释一下我怎样才能延迟断开的会话的超时。在

我的powershell命令如下:

function Run-RemoteAsync($computerName, $pname, $scriptPath, $pargs)
{
    $cred = Get-QRemote-Credential
    Invoke-Command -indisconnectedsession -ComputerName $computerName -Credential $cred -ScriptBlock {powershell -c "$Using:pname '$Using:scriptPath' $Using:pargs"} -ConfigurationName QRemoteConfiguration
}

Tags: 命令行脚本参数远程计算机using小时cred