Author Message
Camillelola
Joined: Jul 21, 2018
Messages: 2
Offline
I'm facing on a crazy problem.

Using PsExec to run batch file remotely on a server. When I use the same command argument in the command line, all is fine.

Here is my batch file:

@ECHO OFF

ECHO %USER% >> "D:\Temp\TextFile.txt"


Here is my call to remote server:

var cmdFileOnRemoteServer = "D:\Temp\myBatchFile.cmd"

var cmdExe = @"C:\Exe\PsExec.exe";
var cmdArgs = string.Format(@"\\{0} -accepteula -u {1} -p {2} {3} {4}", serverName, userName, passWord, cmdFileOnRemoteServer, utilisateur;

proc = new Process();
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.FileName = cmdExe;
proc.StartInfo.Arguments = cmdArgs;
proc.Start();
proc.WaitForExit();
var exitCode = proc.ExitCode;


exitCode = 0 in all time I'm using Asp.NET MVC app using application pool. I already use all option of PsExec. I grand all privilege on a remote server to an application pool which runs a website. Website installed on the server which uses PsExec.



Thanks & Regards

Camillelola
ASP.NET Developer
JohnBiggs
Joined: Jun 20, 2005
Messages: 1139
Location: Rural, Virginia
Online
This forum is related to Application Enablement Services Web Services such as Telephony Web Service and System Management Web Service. I am afraid we can not help you with your remote invocation issue.
Camillelola
Joined: Jul 21, 2018
Messages: 2
Offline
Okay, Thanks for your reply.
Go to:   
Mobile view