From the course: PowerShell for SQL Server Administration

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

PowerShell threading commandlets

PowerShell threading commandlets - PowerShell Tutorial

From the course: PowerShell for SQL Server Administration

Start my 1-month free trial

PowerShell threading commandlets

- [Narrator] Let's talk a little more about threading, 'coz threading is fairly complex topic. So we don't have just the Start-Job cmdlet that we hope for. We do have various other cmdlets available to us as well. So we have the Start-Job cmdlet, which we obviously just saw. That kicks off a background task. We also have Stop-Job, so if you destroy the output of the start-job cmdlet into a variable, we can then use it in some of these other cmdlets when we use that same variable. So when you use that variable in Stop-Job, that's going to stop a background task. We can pause a job using Wait-Job and again just passing the output of Start-Job. And that's going to pause the parent thread and wait for all the jobs to be finished. We also have commands like Receive-Job. So it's going to get the results of the background job that was started by the calling thread. So if we had a parent thread and you do need to get output from that cmdlet, you can do that with the Receive-Job. You can get…

Contents