Redirecting output to the management command prompt.
I am working on a product that runs on a customer facing live system. I am trying to implement console output to the PCA Remote Management Command Prompt so that an administrator can quickly connect and view status without interrupting the live GUI that can be seen by customers. Below is an example of an admittedly ugly attempt written in C#:
var processes = Process.GetProcessesByName("cmd"); if (processes.Length == 0) return; var cmdProcess = processes; _attached = AttachConsole((uint) cmdProcess.Id); Console.WriteLine(@"Test"); Console.Error.WriteLine(@"Error Test"); [DllImport("kernel32", SetLastError = true)] static extern bool AllocConsole();