< Back

Invoke-All

Wed Jan 15, 2020 7:14 am

NAME Invoke-All



SYNTAX

Invoke-All [-ScriptToRun] <scriptblock> [-InputObject] <psobject> [[-MaxThreads] <int>] [[-BatchSize] <int>]

[-ModulestoLoad <string[]>] [-PSSnapInsToLoad <string[]>] [-CopyLocalVariables] [-ProgressBarStage <string>]

[-Async] [-Force] [-NoFileLogging] [-Quiet] [-ReturnasJobObject] [-AppendJobNameToResult] [-WhatIf] [-Confirm]

[<CommonParameters>]



Invoke-All [-ScriptToRun] <scriptblock> [-InputObject] <psobject> [[-MaxThreads] <int>] [[-BatchSize] <int>]

[-RemotePSSessionToUse <psobject>] [-LoadAllTypeDatas] [-ProgressBarStage <string>] [-Async] [-Force]

[-NoFileLogging] [-Quiet] [-ReturnasJobObject] [-AppendJobNameToResult] [-WhatIf] [-Confirm] [<CommonParameters>]



Invoke-All [-ScriptToRun] <scriptblock> [-InputObject] <psobject> [[-MaxThreads] <int>] [[-BatchSize] <int>]

[-RunspaceToUse <RunspacePool>] [-ProgressBarStage <string>] [-Async] [-Force] [-NoFileLogging] [-Quiet]

[-ReturnasJobObject] [-AppendJobNameToResult] [-WhatIf] [-Confirm] [<CommonParameters>]





PARAMETERS

-AppendJobNameToResult

When specified, JobName is appended to the result object



Required? false

Position? Named

Accept pipeline input? false

Parameter set name (All)

Aliases None

Dynamic? false



-Async

When specified, job Objects are created and returned immediately. Jobs will continue to run in the background,

Use Get-InvokeAllJobsStatus and Receive-InvokeAllJobs to check and collect the results.



Required? false

Position? Named

Accept pipeline input? false

Parameter set name (All)

Aliases None

Dynamic? false



-BatchSize <int>

BatchSize controls the number of jobs to run before waiting for one of them to complete



Required? false

Position? 4

Accept pipeline input? false

Parameter set name (All)

Aliases None

Dynamic? false



-Confirm



Required? false

Position? Named

Accept pipeline input? false

Parameter set name (All)

Aliases cf

Dynamic? false



-CopyLocalVariables

Copies the local powershell variable names and its values to the Runspace. DON'T modify or loop through

variables on the jobs as they are not thread-safe



Required? false

Position? Named

Accept pipeline input? false

Parameter set name Default

Aliases None

Dynamic? false



-Force

Cmdlet, by default waits for 30 Seconds for the first Job to complete before Queuing rest of the jobs from

Pipeline. Use -Force to skip this check



Required? false

Position? Named

Accept pipeline input? false

Parameter set name (All)

Aliases None

Dynamic? false



-InputObject <psobject>

Run script against these specified objects. Takes input from Pipeline or when specified explicitly.



Required? true

Position? 1

Accept pipeline input? true (ByValue)

Parameter set name (All)

Aliases None

Dynamic? false



-LoadAllTypeDatas

When specified, The typedata is not loaded in to the RunspacePool, Specify if loading typedata is delaying the

creation of RunspacePool



Required? false

Position? Named

Accept pipeline input? false

Parameter set name RemotePS

Aliases None

Dynamic? false



-MaxThreads <int>

Number of threads to be executed in parallel, by default one thread per logical CPU



Required? false

Position? 2

Accept pipeline input? false

Parameter set name (All)

Aliases None

Dynamic? false



-ModulestoLoad <string[]>

Name of PS Modules or the Full path of the Modules (comma seperated) to load in to the Runspace for the

command to work. Specifiy 'All' to load all the possible modules or 'Loaded' to load the currently loaded

modules



Required? false

Position? Named

Accept pipeline input? false

Parameter set name Default

Aliases None

Dynamic? false



-NoFileLogging

Specifiy this switch if Logging to a file should be skipped



Required? false

Position? Named

Accept pipeline input? false

Parameter set name (All)

Aliases None

Dynamic? false



-PSSnapInsToLoad <string[]>

Name of PSSnapins (comma seperated) to load in to the Runspace for the command to work.



Required? false

Position? Named

Accept pipeline input? false

Parameter set name Default

Aliases None

Dynamic? false



-ProgressBarStage <string>

Provide any useful message to indicate the stage to the user



Required? false

Position? Named

Accept pipeline input? false

Parameter set name (All)

Aliases None

Dynamic? false



-Quiet

When specified, the Progress bar is not shown



Required? false

Position? Named

Accept pipeline input? false

Parameter set name (All)

Aliases None

Dynamic? false



-RemotePSSessionToUse <psobject>

When specified, Remote Runspace opened on the host will be used



Required? false

Position? Named

Accept pipeline input? false

Parameter set name RemotePS

Aliases None

Dynamic? false



-ReturnasJobObject

When specified, instead of returing the Job results, returns the invokeall Job objects itself. It is useful

when you want to access the Streams or other details of each job



Required? false

Position? Named

Accept pipeline input? false

Parameter set name (All)

Aliases None

Dynamic? false



-RunspaceToUse <RunspacePool>

Run New-InvokeAllRunspacepool and use the Output object on this parameter.



Required? false

Position? Named

Accept pipeline input? false

Parameter set name ReUseRunspace

Aliases None

Dynamic? false



-ScriptToRun <scriptblock>



Scriptblock to execute in parallel.

Usually it is the 2nd Pipeline block, wrap your command as shown in the below examples and it should work fine.

You cannot use alias or external scripts. If you are using a function from a custom script, please make sure

it is an Advance function or with Param blocks defined properly.





Required? true

Position? 0

Accept pipeline input? false

Parameter set name (All)

Aliases None

Dynamic? false



-WhatIf



Required? false

Position? Named

Accept pipeline input? false

Parameter set name (All)

Aliases wi

Dynamic? 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

System.Management.Automation.PSObject





OUTPUTS

System.Management.Automation.PSObject





ALIASES

None





REMARKS

None