best/simple way to run .bat file on remote machine - python

I have another machine on the same network, from my machine I can reach this remote machine (both are Windows).
On the remote machine I have .bet file that start some service.
What is the simplest way to reach this .bat file and run this file on the remote machine?

Related

How can I run a python script which is stored in my local machine on another database server?

I have a python script on my local machine related to a database. I can log in to that database server through a SSH connection. But how can I run my python file on that database server?
Do I need to upload my python script on that server machine? How can I do that?
I logged in to the database server through the ssh connection. I have access to that.
I ran my python file which is stored in my local machine on that server.
It shows "python3: can't open file .. No such file or directory"
I want to run the program and see the output.

How to delete file on Windows Remote Server?

How to delete specific file on Windows Remote Server using Python?
I'm able to connect to remote Windows Server using WMI, but not sure how to delete file remotely on windows server.

run .bat file on remote machine

I try to run .bat file on remote machine.
From my machine i mapped the folder where my .bat (on the remote machine) is exist and from my machine i just try to run the file:
os.system(r'‪Y:\file.bat')
But it seems that nothing hapenning.
Any suggestions ?
BTW both machines are Windows

How to copy a file from one windows server to another remote windows server using python?

I connect remote server(via Remote desktop) using username/password.
How can I copy one file from my machine to that remote windows machine using python?

Run local batch file on remote system with Python WMI

I want to run a local batch file on a remote system with WMI, instead of running a batch file on the remote system. The reason behind this is that I'll need the directory to which I'm referencing in the batch file to be variable, and adjustable by the user. How exactly can I do this? Reference the local file and run it, or send it to the remote sytem? How do I code it either way?
The reason I chose WMI was because it has been extremely reliable thus far, and I have no intention of reusing PsExec, and I have no need for ssh.
Referencing the local file on the remote system is bad because the remote system user has to have access to the file system on your local system which is - viewed by the remote system - a remote system.
You would have to have a share on your local machine which is accessible from the remote system and modify the batch to access the UNC-Path (pushd).
The best way would be to copy the batch to the remote system (or create it dynamically on the remote system) and execute it from there.
How to create remote processes can be read at this question,
several ways to copy files to a remote system are described here

Categories

Resources