My application launches "C:\Windows\System32\Msra.Exe" to control a domaincomputer. Is there a way I can capture the error messages that this msra.Exe shows. (I.e. internal error messages from the msra.exe and not the ones from my app.) The app itself is a windows Forms app.
Any help is appreciated.
The Code to start MSRA is below... it is just a snippet of the complete application.
string msra = "C:\\Windows\\System32\\runas.exe";
string domainname = "**********";
string domaincontroller = "*************";
if (File.Exists(msra) == false)
{
System.Windows.Forms.MessageBox.Show("Runas.exe not found.\n\rPlease contact your internal IT support.", "Fatal Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
}
else
{
try
{
Process p = new Process();
p.StartInfo.UseShellExecute = true;
p.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
p.StartInfo.ErrorDialog = true;
p.StartInfo.FileName = msra;
p.StartInfo.Arguments = "/noprofile /netonly /user:" + domainname + "\\" + username + " \"cmd /server:" + domaincontroller + " /C msra.exe /offerra " + computerip + "\"";
p.Start();
p.Dispose();
Thread.Sleep(1700);
SendKeys.SendWait(password);
SendKeys.SendWait("{ENTER}");
}
catch
{
System.Windows.Forms.MessageBox.Show("MSRA could not be started for an unknown reason");
}
}