Answer the question
In order to leave comments, you need to log in
How to fix PsExec launch issue in C#?
You need to remotely install the MSI package using the PsExec utility. All this must be done through a C# console application. Here is my solution:
string psExecPath = @"C:\Program Files\Utility\64\PsExec.exe";
string arg = String.Join(" ", args);
var process = new Process()
{
StartInfo = new ProcessStartInfo(psExecPath, arg)
{
RedirectStandardError = true,
UseShellExecute = false,
WindowStyle = ProcessWindowStyle.Hidden,
CreateNoWindow = true
}
};
Console.WriteLine("Starting process...");
process.Start();
process.WaitForExit(60000);
if (!process.HasExited)
{
process.Kill();
Console.WriteLine("Wait for exit: Time out");
return;
}
if (process.ExitCode != 0)
Console.WriteLine($"Error occurred during the execution PsExec. ErrorCode {process.ExitCode}");
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question