1

Is it possible to embed a Powershell screen in my application?

I want to see the screen itself, just like Visual Studio does. I cannot use a console redirect as that option would not allow me to interact with programs or view programs displaying colors and the like.

Capture both standard input and standard output is not a possible solution. I am using programs that use colors and progress bars.

It would be something similar to being able to implement a Windows Terminal, or https://github.com/dwmkerr/consolecontrol

I also tried this code, but it does not allow me to embed to Terminal server although I can use it with Notepad Run extended programs GUI on my own c# form

Looking for information, I found a project that apparently could be what I am looking for but it does not work with Winforms and I cannot find a simple example of use. https://github.com/PowerShell/PowerShellEditorServices

Victor Sanchez
  • 583
  • 9
  • 28
  • Yes. You need to capture both standard input and standard output. – jdweng May 12 '21 at 18:41
  • Check out this question and the multiple answers. There is a linked example for doing this with winforms even though it focuses on WPF: https://stackoverflow.com/questions/3284500/embed-a-console-window-inside-a-wpf-window – Cpt.Whale May 12 '21 at 18:56
  • @Cpt.Whale The solutions listed are not valid. The code I use does not capture the powershell window and the option to use the stardand input / output is not valid because it would not correctly display the colors and progress. – Victor Sanchez May 12 '21 at 19:01
  • @VictorSanchez [maybe](https://stackoverflow.com/questions/758494/how-can-i-run-another-application-within-a-panel-of-my-c-sharp-program) that would be useful? – Trevor May 12 '21 at 19:05
  • @zaggler this code is very similar to https://stackoverflow.com/questions/34764526/run-extended-programs-gui-on-my-own-c-sharp-form with powershell.exe don't work. I think that code does not work with console applications such as poowershell. – Victor Sanchez May 12 '21 at 19:19

0 Answers0