In the application that I'm working on, everything works great. My question, is there a way to suppress the command windows when executing psexec? I want this to run silently. Below is the code that I'm using.. I've read many examples online but nothing seems to be working. Thoughts? Thanks.
Process p = new Process();
try
{
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.RedirectStandardInput = true;
p = Process.Start(psExec, psArguments);
if (p != null)
{
string output = p.StandardOutput.ReadToEnd();
string error = p.StandardError.ReadToEnd();
p.WaitForExit();
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
finally
{
if (p != null)
{
p.Dispose();
}
}