title: Unable to run user script in Unix server from Windows using C# and SSH.NET
body: <p>I have a script in Perl which runs on a Unix server (Solaris to be precise). The script uses ftp utility to condition files in a mainframe server and then transfer them to Unix server.</p>
  
  <p>Recently, I am trying to develop a Windows desktop application using Windows forms and C#. I am trying to use the SSH.NET library available from codeplex. The problem is, whenever I run a normal Unix command from the application it works, but when I try to run the script it does not work. I have checked the connection and the application is properly connecting to the server. I have used both the below methods but no luck :-</p>
  
  <pre><code>using (ssh client = new SshClient("Ip", "username", "password"))
  {
      client.Connect();
      SshCommand cmd = client.RunCommand("script");
      client.Disconnect();
  }
  </code></pre>
  
  <hr>
  
  <pre><code>using (ssh client = new SshClient("hostnameOrIp", "username", "password")) 
  {
      client.Connect();
      SshCommand cmd = client.createCommand("script");
      cmd.execute();
      client.Disconnect();
  }
  </code></pre>
  
  <p>It would be a huge help if somebody points me towards a proper direction.</p>
  
  <p>EDIT :- Running the script with the full path has worked as the non interactive shell that is invoked doesn't read the /etc/profile/ env variables when it loads. I will try out the other options suggested as well and edit the post if something works.</p>