Collections:
Other Resources:
"Remove-Job" Cmdlet in Windows PowerShell
How to use "Remove-Job" cmdlet in Windows PowerShell?
✍: FYIcenter.com
You can use the "Remove-Job" cmdlet to remove an stopped or completed background job
by using the "-id n" or "-name xxx" to specify the background job.
If the background job is still running, you can use the "-Force" option to remove it.
Here is an example of using the "Remove-Job" cmdlet:
PS C:\fyicenter> start-job {for($i=0; $i -lt 100; $i++) {write-host "$i sec"; sleep 1} }
Id Name PSJobTypeName State Command
-- ---- ------------- ----- -------
18 Job18 BackgroundJob Running for($i=0; $i -lt 100...
PS C:\fyicenter> get-job
Id Name PSJobTypeName State Command
-- ---- ------------- ----- -------
2 Job2 BackgroundJob Completed get-process
4 Job4 BackgroundJob Completed $now = get-date
18 Job18 BackgroundJob Running for($i=0; $i -lt 100...
PS C:\fyicenter> remove-job 18
remove-job : The command cannot remove the job with the job ID 18
because the job is not finished. To remove the job, first stop the
job, or use the Force parameter. Parameter name: SessionId
At line:1 char:1
+ remove-job 18
+ ~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation:
(System.Manageme...n.PSRemotingJob:PSRemotingJob) [Remove-Job], Argume ntException
+ FullyQualifiedErrorId : JobObjectNotFinishedCannotBeRemoved,
Microsoft.PowerShell.Commands.RemoveJobCommand
PS C:\fyicenter> remove-job 18 -force
⇒ "Invoke-Command -AsJob" - Remote Background Jobs in PowerShell
⇐ "Stop-Job" Cmdlet in Windows PowerShell
2016-10-08, ∼3347🔥, 0💬
Popular Posts:
How to remove AcroIEHelper.dll - Adobe Acrobat IE Helper Version 6.0 for ActiveX? DLL AcroIEHelper.d...
What is smss.exe process - Windows NT Session Manager? Process smss.exe is part of Windows system. I...
What is "Ulead Burning Helper" in my Windows 7 service list? And how is "Ulead Burning Helper" servi...
How to remove AcroIEHelper.dll - Adobe Acrobat IE Helper Version 6.0 for ActiveX? DLL AcroIEHelper.d...
Can I disable Windows service "HTTP SSL" to speedup my computer? Windows service "HTTP SSL" - This s...