How to connect to a remote Windows machine to execute commands using python?

后端 未结 11 2107
青春惊慌失措
青春惊慌失措 2020-11-29 20:20

I am new to Python and I am trying to make a script that connects to a remote windows machine and execute commands there and test ports connectivity.

Here is the cod

11条回答
  •  我在风中等你
    2020-11-29 21:12

    do the client machines have python loaded? if so, I'm doing this with psexec

    On my local machine, I use subprocess in my .py file to call a command line.

    import subprocess
    subprocess.call("psexec {server} -c {}") 
    

    the -c copies the file to the server so i can run any executable file (which in your case could be a .bat full of connection tests or your .py file from above).

提交回复
热议问题