Tutorial by Examples

Start a Script Block as background job: $job = Start-Job -ScriptBlock {Get-Process} Start a script as background job: $job = Start-Job -FilePath "C:\YourFolder\Script.ps1" Start a job using Invoke-Command on a remote machine: $job = Invoke-Command -ComputerName "ComputerName&...
Get a list of all jobs in the current session: Get-Job Waiting on a job to finish before getting the result: $job | Wait-job | Receive-Job Timeout a job if it runs too long (10 seconds in this example) $job | Wait-job -Timeout 10 Stopping a job (completes all tasks that are pending in t...

Page 1 of 1