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, ∼2904🔥, 0💬
Popular Posts:
How to view services with the System Configuration tool "msconfig.exe" on Windows 7? System Configur...
How to download and install Yahoo Toolbar for Internet Explorer (IE) 7 browser? Yahoo Toolbar adds s...
How do I know what cookies a Website is sending to my computer? When you are visiting a Website, it ...
How to remove REFIEBAR.DLL - Microsoft Research Extra Toolbar Button and Extra Tools Menu Item for I...
What is the "Smart Card Device Enumeration Service (ScDeviceEnum)" system service on Windows Server ...