15

Asynchronous Processing

PowerShell prefers to run things synchronously, that is, sequentially, or one after another. However, it is frequently necessary to run many things simultaneously, without waiting for another command to complete. This is known as an asynchronous operation.

Operations of this nature may be local to the current machine or might run queries or code against remote systems.

PowerShell includes several different commands and classes that can do more than one thing at a time. The most obvious of these are the job commands.

In addition to the job commands, PowerShell can react to .NET events and use runspaces and runspace pools.

This chapter explores the following topics:

  • Working with jobs
  • Reacting to events
  • Using runspaces ...

Get Mastering PowerShell Scripting - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.