Search code examples
c#dockerbatch-fileremote-server

How to make a batch script to run commands on a remote machine using credentials


I have wrote some batch scripts to perform docker commands on a machine and made it run using c# program. I can successfully run those batch scripts in my local machine, but I want it to run on a remote machine. How can I do that by giving remote machine access credentials? I am looking for batch commands that will first connect to the remote machine and then execute its body in remote machine. A sample batch script is as below.

::Start an exited container
::Iam expecting some code here to connect to a remote machine
@echo off
docker start %1

Or, Is there any option to do it through c# program?


Solution

  • Try using PsExec https://learn.microsoft.com/en-us/sysinternals/downloads/psexec

    This is a light weight replacement for telnet