Powershell: get output from Receive-Job

前端 未结 7 1621
误落风尘
误落风尘 2020-12-09 08:57

I have a collection of jobs that are running. When they complete I use receive-job and it writes the output to the screen. I\'d like to take that output and log it to a file

7条回答
  •  长情又很酷
    2020-12-09 09:10

    When you receive the results of a job those results are deleted such that further calls to Receive-Job will have nothing to retrieve (assuming the job is completed). If you don't want Receive-Job to delete the results use the -Keep switch. Now this doesn't explain why your first call to Receive-Job isn't outputting anything to the log file ... unless there is a part of the script you're not showing that is doing a Receive-Job before this.

提交回复
热议问题