I know I get a job's output when calling Receive-Job. But as you can see with Get-Job | Format-List -Property *
, jobs jave a lot of properties, most of them seem to be unused.
I want to track progress and maybe some errors, but how do I pass some data to the Progress, Output and Error properties from within the job?
How to get live data (output, progress) from a powershell job?
1.1k Views Asked by user2727133 At
1
You can use the Receive-Job cmdlet The Receive-Job cmdlet gets the results that have been generated by the time that the Receive-Job command is submitted. If the results are not yet complete, you can run additional Receive-Job commands to get the remaining results.
I would recommand to read about it more with:
Also, please note that when you run the Receive-Job, it will remove the results after showing it. If you want to keep them, you will have to use the -Keep Switch
Powershell can't show you progress of the job natively, and you will have to find other ways.. you can use the Receive-Job to see what is already done.
let me know if it helped you.