PowerShell Start-Job

The Start-Job Cmdlet is a fast and extremely simple means of spawning asynchronous threads. Why do we care? Because performing parallel work is faster and our time is important. If I want to inventory the Windows services running on every server in my company, I don’t want to wait for each one to return data, one at a time. Before I move on with the Start-Job Cmdlet, there are two other notable concurrency methods that I won’t be covering in this post; runspaces, and work-flows.

To demonstrate I will use the Windows services task that I mentioned above. Here is how we can find a list of all of the Windows services running on a single server.

Finally, I will demonstrate how to initialize the job with a script. This is often used to pre-load functions to be used in the script block. Let us say that I’ve created a function and saved it as a scriptblock.