Python: run a process inside a windows host

2019-08-21 17:04发布

I need to run a process inside a windows host from a linux host using python. I saw WMI python library but seems to work only from a windows host, not linux, how can I do? I neeed something like PSEXEC, but it works only for windows.

2条回答
beautiful°
2楼-- · 2019-08-21 17:55

An easy solution is to run a SSH server on the windows box and use the paramiko library on the client side.

查看更多
疯言疯语
3楼-- · 2019-08-21 17:58

Since you cannot install anything on the windows host, does it have openoffice, or libreoffice installed? You coult then use the Python interpreter bundled with it to create a python script that listens to xmlrpc and get you job done, controling this script remotely.

If there is no Python installed on the windows side, and yur remote host is Linux, there is this recipe here: http://code.activestate.com/recipes/577945-execute-remote-commands-on-windows-like-psexec/ It does depend on windows - as it imports win32wnet - in my experience, these windows specific modules will run fine in a Windows python installed on a Wine configuration on a Linux machinne.

查看更多
登录 后发表回答