Joe Dolamo

Joe Dolamo

  • NA
  • 4
  • 1.5k

Connecting to a remote server

Jun 10 2015 5:21 AM
Hi
 
I'm trying to connect to a remote server, but can't seem to get through, here's a code snippet that I used.
 
var  psExecPath = Server.MapPath (~/content/RequredFiles/PsExec.exe); 
var MachineName = "\\Machinesname"; 
var Command = "C:\program Files\MyMachine\My application.exe";
var Execute = "{0} {1},MachineName,Command" 
var proc = new Process(); 
var PSI = new ProcessStartInfo(psExecPath,Execute)
 
PSI.CreatNoWindow = true;
PSI.RedirectStandartError = false;
PSI.RedirectStandartOutput = true;
PSI.UseShellExecute = false;
PSI.RedirectStandardInput = false;
proc.Startinfo = PSI;
proc.Start();
proc.BeginOutputReadLine(); 
 
 So basically I want to run "Command" on a cmd from a remote server, but I can't seem to be getting the results. please assist.
 

Answers (1)