I am using the following code to run an external application from powershell:
$Process = New-Object System.Diagnostics.Process
$Process.StartInfo.FileName = "..."
$Process.StartInfo.WorkingDirectory = "..."
$Process.StartInfo.RedirectStandardError = $true
$Process.StartInfo.RedirectStandardOutput = $true
$Process.StartInfo.UseShellExecute = $false
$Process.StartInfo.Arguments = "..."
What I need is a way to dynamically capture any output that the application makes i.e. not wait for the application to exit before returning the output. The application is long running and reports status information back to the user which I would like to output as part of the powershell script. I have been unable to find anything online that does this but I am sure this must be possible?