< Back

Invoke-Concurrent

Sun Jan 19, 2020 6:27 pm

NAME Invoke-Concurrent



SYNOPSIS

Invokes a set of script blocks concurrently.





SYNTAX

Invoke-Concurrent [-ScriptBlock] <ScriptBlock[]> [-MaxConcurrency <Int32>] [-Variable <PSVariable[]>] [-Module

<PSModuleInfo[]>] [<CommonParameters>]





DESCRIPTION





PARAMETERS

-ScriptBlock <ScriptBlock[]>

The script block(s) to run concurrently.



Required? true

Position? 0

Default value None

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-MaxConcurrency <Int32>

The maximum number of simultaneously running script blocks. The default is the number of processor threads on

the current computer.



Required? false

Position? named

Default value [Environment]::ProcessorCount

Accept pipeline input? false

Accept wildcard characters? false



-Variable <PSVariable[]>

Variables to set for script blocks. Use Get-Variable to obtain PSVariable objects.



Required? false

Position? named

Default value None

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-Module <PSModuleInfo[]>

Modules to import for script blocks. Use Get-Module to obtain PSModuleInfo objects.



Required? false

Position? named

Default value None

Accept pipeline input? true (ByPropertyName)

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

ScriptBlock[]

Script block(s) to run concurrently.





OUTPUTS

PSConcurrent.TaskOutput[]

Output of the invoked ScriptBlocks. Each output object is wrapped in TaskOutput object that identifies which

scriptblock produced the output.







RELATED LINKS

https://github.com/sharpjs/PSConcurrent

Get-Module

Get-Variable