title: Run batch file on remote machine using psExec in Python
body: <p>I can run the batch file from the command prompt like this</p>
  
  <pre><code>PsExec.exe \\remoteMachine "C:\Users\admin\test.bat"
  </code></pre>
  
  <p>I am trying to call the same above command using python</p>
  
  <pre><code>remoteCommand = r'C:\Users\username\test.bat' 
  argList = ["PsExec.exe", remoteCommand]
  out = subprocess.check_output(argList)
  print "Output: ", out
  </code></pre>
  
  <p>But it throws an error shown below</p>
  
  <pre><code>The system cannot find the file specified.
  
  PsExec could not start C:\Users\admin\test.bat:
  .
  .&lt;Stacktrace present here&gt;
  .
  raise CalledProcessError(retcode, cmd, output=output)
  subprocess.CalledProcessError: Command '['PsExec.exe', 'C:\\Users\\admin\\test.bat']' returned non-zero exit status 2
  </code></pre>