Greetings,
could you help me with a question?
Basically, I wrote a Win Form in Visual Studio 2010. My application opens powershell and runs a simple script. New-AdUser.....and it gives me an exception in powershell. I am trying to place this exception into a Rich TextBox in my Win Form.
Is there a specific command I could use to place PowerShell output into a rich text box.
So far I am doing the following:
Process d = new Process();d.StartInfo.UseShellExecute = false;
d.StartInfo.RedirectStandardError = true;
d.StartInfo = new ProcessStartInfo("powershell.exe", module + "; " + command);
d.OutputDataReceived += d_OutputDataReceived;
d.Start();
}
private void d_OutputDataReceived(object sender, DataReceivedEventArgs e)
{
richTextBox1.Text = e.Data;
} The text box doesn't show anything