September 18th, 2014

PowerTip: Cause PowerShell to Wait for Specific Event

Doctor Scripto
Scripter

Summary: Cause Windows PowerShell to wait for a specific event to be generated.

Hey, Scripting Guy! Question How can I make my Windows PowerShell console halt until an event that I registered by using the 
           Register-CimIndicationEvent cmdlet occurs?

Hey, Scripting Guy! Answer Use the Wait-Event cmdlet and specifiy the source identifier. For example, if you registered
           for an event named nq, use the following command:

Wait-Event -SourceIdentifier nq

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.