I have following commands that I can execute in powershell
directly and works fine.
psftp my-user@linux-host
get /tmp/oldname C:\newname
Now, I want to execute them through a linux host using pywinrm like below:
s = winrm.Session('windows-host:', transport='ntlm', auth=('my-user', 'secret'))
r = s.run_cmd('psftp my-user@linux-host')
r.status_code
r.std_out
But. the issue is at step r = s.run_cmd('psftp my-user@linux-host')
the python terminal just goes in an infinite non responsive mode.
I assume the reason behind this is that on remote windows host the control has been transferred to a new new psftp shell. Any other command such as s.run_cmd('ipconfig', ['/all'])
just runs fine.
However for psftp, I am not sure how to counter this issue and issue the next command?