title: how to use paramiko ssh object to send remote calls to Windows and Linux server?
body: <p>I am using Python 2.7.6 and Paramiko module (on a Linux server) to connect to a Windows server and send some commands and get output. I have a connect function which takes IP, username and password of the remote Windows server and I get an sshobj when that happens. How do I use it to send remote calls is my question?</p>
  
  <p>If it were a local system, I would just say "os.system" but not sure about the remote calls. Can someone help?</p>
  
  <p>My code looks like below:
      sys.path.append("/home/me/code")</p>
  
  <pre><code>import libs.ssh_connect as ssh
  ssh_obj = ssh.new_conn(IP, username, password)
  
  stdin, stdout, stderr = ssh_obj.exec_command("dir") #since the remote    system I am SSHing into is Windows.
  </code></pre>
  
  <p>my "new_conn" looks like this:</p>
  
  <pre><code>import paramiko
  def new_conn(IP, username, password):
      ssh_obj = paramiko.SSHClient()
      ssh_conn.set_missing_host_key_policy(paramiko.AutoAddPolicy())
      ssh_conn.connect(IP, username, password), timeout=30)
      return ssh_obj
  </code></pre>
  
  <p>All I get from stdin, stdout and stderror is "active; 1 open channel anhd some bunch of info like ChannelFile, aes, etc..).</p>
  
  <p>I was hoping to see the output of "dir" from Windows on my Linux..</p>
  
  <p>tried "stdout.read()" and "stdout.readlines()" but the former came out with "stdout" and the latter came out with "[]"!</p>
  
  <p>Thanks!</p>