< Back

Wait-ForCondition

Wed Jan 15, 2020 4:24 am

NAME Wait-ForCondition



SYNOPSIS

Wait for the condition to be true on all inputObject items.





SYNTAX

Wait-ForCondition -InputObject <Object[]> -Condition <ScriptBlock> [-TimeoutInMilliseconds <Int64>]

[<CommonParameters>]



Wait-ForCondition -InputObject <Object[]> -Condition <ScriptBlock> [-TimeSpan <TimeSpan>] [<CommonParameters>]





DESCRIPTION

Given a set inputObjects, iterate over each of them until they all meet the condition specified or the timeout

expires.





PARAMETERS

-InputObject <Object[]>

The object on which to check the condition.



Required? true

Position? named

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Condition <ScriptBlock>

A predicate that takes the input object and returns true or false regarding whether the condition is met.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-TimeSpan <TimeSpan>

A timeout specified as a TimeSpan. Note that TotalMilliseconds on the timeot must be more than 0 or else

the parameter will fail validation.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-TimeoutInMilliseconds <Int64>

The timeout specified in milliseconds.



Required? false

Position? named

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES





General notes



-------------------------- EXAMPLE 1 --------------------------



PS>1..1000 | Wait-ForCondition -TimeSpan (New-TimeSpan -Seconds 1) -Condition { ((Get-Random -Minimum 1 -Maximum

11)%2) -eq 0 }



Attempt to generated even numbers 1000 times using Get-Random but timeout.











RELATED LINKS





CommonParameters : True

WorkflowCommonParameters : False

details : @{name=Test-Command; noun=; verb=}

Syntax : @{syntaxItem=System.Object[]}

parameters : @{parameter=System.Object[]}

inputTypes : @{inputType=}

returnValues : @{returnValue=}

aliases : None



remarks : None

alertSet :

description :

examples :

Synopsis :

Test-Command [-command] <string[]> [<CommonParameters>]



ModuleName : IntelliTect.Common

nonTerminatingErrors :

xmlns:command : http://schemas.microsoft.com/maml/dev/command/2004/10

xmlns:dev : http://schemas.microsoft.com/maml/dev/2004/10

xmlns:maml : http://schemas.microsoft.com/maml/2004/10

Name : Test-Command

Category : Filter

Component :

Role :

Functionality :