I have a winrm4j client, that invokes a PowerShell command on a remote windows host. The PS command runs continuously, since it acts as an event listener, and collects event data continuously. Is it possible to read the stdout of this PS process via winrm4j in real-time, while the PS process is simultaneously running? Note that I do get the data from stdout, after I kill the PS process manually, since it is not expected to exit by itself.
Asked
Active
Viewed 282 times
1
-
Using the StandardOutput.ReadToEnd() method on a System.Diagnostics.ProcessStartInfo should give you what you're after methinks. See here from another post: https://stackoverflow.com/questions/8761888/capturing-standard-out-and-error-with-start-process – trebleCode Jan 25 '18 at 14:39