Collections:
Other Resources:
"Receive-Job" Cmdlet in Windows PowerShell
How to use "Receive-Job" cmdlet in Windows PowerShell?
✍: FYIcenter.com
You can use the "Receive-Job" cmdlet to receive output result from an existing background job
by using the "-id n" or "-name xxx" to specify the background job.
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.
By default, job results are deleted from the system when you receive them, but you can use the Keep parameter to save the results so that you can receive them again. To delete the job results, run the Receive-Job command again (without the Keep parameter), close the session, or use the Remove-Job cmdlet to delete the job from the session.
Here is an example of using the "Receive-Job" cmdlet to receive the output of an existing backgroundjob:
PS C:\fyicenter> start-job {get-process}
Id Name PSJobTypeName State HasMoreData Command
-- ---- ------------- ----- ----------- -------
2 Job2 BackgroundJob Running True get-process
PS C:\fyicenter> receive-job -id 2 -keep
Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
2155 9 4964 724 92 19.78 4472 AdobeARM
135 5 4264 220 57 1.56 4044 cmd
161 8 26516 2232 74 1.65 3140 CmRcService
51 3 1368 1052 46 4.29 1760 conhost
52 3 1880 1128 46 3.39 4808 conhost
...
PS C:\fyicenter> receive-job -id 2 -keep
Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
2155 9 4964 724 92 19.78 4472 AdobeARM
135 5 4264 220 57 1.56 4044 cmd
161 8 26516 2232 74 1.65 3140 CmRcService
51 3 1368 1052 46 4.29 1760 conhost
52 3 1880 1128 46 3.39 4808 conhost
...
Note that the "-keep" option keeps the out in the background job, instead of deleting it.
⇒ "Stop-Job" Cmdlet in Windows PowerShell
⇐ "Get-Job" Cmdlet in Windows PowerShell
2016-10-08, ∼3024🔥, 0💬
Popular Posts:
What is HelpSvc.exe - Microsoft Help Center Service? That is HelpSvc.exe? There many answers on the ...
Where to find information about what system services are running on Windows Server 2012? I want to k...
How to view system properties on Windows Server 2016? I just want to get some basic information abou...
How do I move my library to a new computer? You must perform multiple steps before and after moving ...
In MS Access form design, can I select multiple fields and modify their properties simultaneously? Y...