I think i found a solution to redirect all the file using write-out and >> to a file then read it in text box but it only output the result after the script finish running. Anyway to output in real time to the textbox?
I am not popping a console for my GUI. What I am asking is the output of like Write-Host written to a textbox. My current method is using Write-Output to a file then read that file in the textbox. However that is not real time. There is no console involve.
There are a few approaches to populating a textbox, you’re running into the standard issue where while a script is running, your forms become unresponsive.
you have a few choices, background jobs is one approach, there were a number of articles on sapiens forums walking through various approaches.
heres the first one i could find.
in general your form will be non-responsive the entire time a block of code is executed locally.