Contact Info

Crumbtrail » Administration » Powershell » Powershell 2.0 » Wait-Job

Wait-Job - Powershell 2.0 CmdLet

Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.

More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.


Short description
Suppresses the command prompt until one or all of the Windows PowerShell background jobs running in the session are

Wait-Job [[-InstanceId] <Guid[]>] [-Any] [-Timeout <int>] [<CommonParameters>]

Wait-Job [-Job] <Job[]> [-Any] [-Timeout <int>] [<CommonParameters>]

Wait-Job [[-Name] <string[]>] [-Any] [-Timeout <int>] [<CommonParameters>]

Wait-Job [-Id] <Int32[]> [-Any] [-Timeout <int>] [<CommonParameters>]

Wait-Job [-State {NotStarted | Running | Completed | Failed | Stopped | Blocked}] [-Any] [-Timeout <int>] [<CommonP

The Wait-Job cmdlet waits for Windows PowerShell background jobs to complete before it displays the command prompt.
 You can wait until any background job is complete, or until all background jobs are complete, and you can set a ma
ximum wait time for the job. 

You can use Wait-Job to get background jobs that were started by using Start-Job or the AsJob parameter of Invoke-C

When the commands in the job are complete, Wait-Job displays the command prompt and returns a job object so that yo
u can pipe it to another command.