Wait-Device

Waits until a particular device is available before continuing to run.

Powershell

The Wait-Device cmdlet suspends execution of a script or function until a particular device is available. Execution resumes when the device is detected. To cancel the wait, press CTRL+C.

Syntax

Wait-Device [-deviceId] [[-timeout] ] []

Parameters

name description
deviceId The identifier of the device for which to wait.
timeout Specifies the maximum time, in seconds, that Wait-Devices waits for the event to become available. The default, -1, waits indefinitely. The timing starts when you submit the Wait-Device command. If the specified time is exceeded, the wait ends and the command prompt returns, even if the device is not available. No error message is displayed.

Examples

Wait-Device -deviceId 9e8438ab23a10a20cd2d4d8d9616b405d008344f