I'm using pypsexec to connect to a remote Windows machine. I've to find a list of files with a certain extension. This is what I'm doing right now.
command = "dir /b/s *.py"
client.run_executable("cmd.exe", arguments=f"/c {command}", asynchronous=True)
I wasn't receiving any responses at first when I didn't use the asynchronous parameter. Having read the documentation, I can see that long-running tasks (like mine) should use this parameter. However, it doesn't provide explicit instructions on how to get the output after the job is finished.
Thanks in advance!
This is because you can't get the output. See https://github.com/jborean93/pypsexec/blob/master/pypsexec/client.py#L436-L466
if not interactive and not asynchronous:
[...] # Here is where stdout and stderr is set
else:
stdout_out = None
stderr_bytes = None
[...] # Here is some code that doesn't change stdout_out or stderr_bytes
return stdout_out, stderr_bytes, return_code
As you can see when using asynchronous=True
the stdout and stderr will always be None