Contact Info

Crumbtrail » Administration » Powershell » Powershell 2.0 » Wait-Event

Wait-Event - 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
Waits until a particular event is raised before continuing to run.

Wait-Event [[-SourceIdentifier] <string>] [-Timeout <int>] [<CommonParameters>]

The Wait-Event cmdlet suspends execution of a script or function until a particular event is raised. Execution resu
mes when the event is detected. To cancel the wait, press CTRL+C. 

This feature provides an alternative to polling for an event. It also allows you to determine the response to an ev
ent in two different ways: by using the Action parameter of the event subscription and by waiting for an event to r
eturn and then respond with an action.