You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is more of a dumb question than an issue. I want to be able to set a maximum timeout for a PS command to execute in. For example, if the command I execute is "Start-Sleep 900" I want to say "wait a maximum of 60 seconds".
I was able to do this with pyWinRM by sub-classing Protocol. So the problem in replacing pyWinRM is making sure pypsrp does everything I could do before... This (command execution timeout) and setting IdleTimeout are the only things I am missing.
transport = powershell_pypsrp_transport(PARAMS["server"])
transport.connect(PARAMS)
start_time = time.time()
print("Executing command with command length: {}...".format(len(PARAMS["cmd"])))
transport.run_powershell(PARAMS["cmd"])
end_time = time.time()
if transport.had_errors:
print("Errors returned from command: {}".format(transport.stderr))
else:
print("Results:\n\n{0}\n".format(transport.stdout))
print("Command executed in {} seconds\n".format(int(end_time - start_time)))
But whilst I see that for Shell thre is idle_time_out and lifetime (would lifetime do what I want???) I cannot see how to actually use them in the above code.
The text was updated successfully, but these errors were encountered:
This is more of a dumb question than an issue. I want to be able to set a maximum timeout for a PS command to execute in. For example, if the command I execute is "Start-Sleep 900" I want to say "wait a maximum of 60 seconds".
I was able to do this with pyWinRM by sub-classing Protocol. So the problem in replacing pyWinRM is making sure pypsrp does everything I could do before... This (command execution timeout) and setting IdleTimeout are the only things I am missing.
This very basic code works fine:
Using:
But whilst I see that for Shell thre is idle_time_out and lifetime (would lifetime do what I want???) I cannot see how to actually use them in the above code.
The text was updated successfully, but these errors were encountered: