-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RunspacePool close fail #53
Comments
How long is long? It sounds like there's some sort of timer on the session from the server and when you go to run the last command it times out. |
About 120 seconds, Server is Windows Server 2012R2, Client is Win7. from pypsrp.powershell import PowerShell, RunspacePool
from pypsrp.wsman import WSMan
if __name__ == "__main__":
wsman = WSMan('192.168.5.31',
username='user',
password='passwd',
port=5985,
auth="credssp",
ssl=False)
pool = RunspacePool(wsman)
pool.open()
shell = PowerShell(pool)
shell.add_script(
r'Start-Job -ScriptBlock { python.exe -c"import time;time.sleep(1000)" }'
)
shell.add_cmdlet("Out-String").add_parameter("Stream")
output = shell.invoke()
if shell.had_errors:
log.error(shell.streams.error[0])
print('\n'.join(output))
import time
time.sleep(120)
pool.close() |
Cool so not something that is really long so this should work, let me try it out when I get a chance to see if I can replicate it. |
We are seeing a similar behavior when uploading a file to a Windows Server 2016. |
@jborean93 so we found out what the issue was in our case: it is on the client side rather than on the server side. We were trying to upload the same file to multiple servers simultaneously. It was not working. We had to use |
Hi, I am start a long run command on remote host. After a long time , I close runspace pool, get this error, and I can't stop pssession on remote host.
How to run a long task with
pypsrp
?The text was updated successfully, but these errors were encountered: