mirror of
https://github.com/freedbygrace/Invoke-PSThread.git
synced 2026-08-11 18:56:54 +00:00
Update README.md
This commit is contained in:
@@ -1,60 +1,49 @@
|
|||||||
|
---
|
||||||
|
external help file: -help.xml
|
||||||
|
Module Name:
|
||||||
|
online version:
|
||||||
|
schema: 2.0.0
|
||||||
|
---
|
||||||
|
|
||||||
# Invoke-PSThread
|
# Invoke-PSThread
|
||||||
.SYNOPSIS
|
|
||||||
|
## SYNOPSIS
|
||||||
|
|
||||||
Enables the ability to leverage multithreading within powershell whilst reducing the complexity to get started.
|
Enables the ability to leverage multithreading within powershell whilst reducing the complexity to get started.
|
||||||
|
|
||||||
.DESCRIPTION
|
## SYNTAX
|
||||||
This function aims to remove the enormous complexity out of multithreading within powershell. See the fully working examples below.
|
|
||||||
|
|
||||||
.PARAMETER Runspace
|
### Runspace (Default)
|
||||||
Your parameter description
|
|
||||||
|
|
||||||
.PARAMETER RunspacePool
|
```
|
||||||
Your parameter description
|
Invoke-PSThread -RunspaceDefinition <ScriptBlock> [-ApartmentState <ApartmentState>] [-AssemblyList <SessionStateAssemblyEntry[]>] [-Confirm] [-ContinueOnError] [-FunctionList <FunctionInfo[]>] [-ModuleList <PSModuleInfo[]>] [-Runspace] [-RunspaceParameters <Hashtable>] [-SynchronizedHashtable <PSVariable>] [-ThreadOption <PSThreadOptions>] [-VariableList <PSVariable[]>] [-WaitForAvailableRunspace] [-WhatIf] [<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
.PARAMETER Await
|
### RunspacePool
|
||||||
Your parameter description
|
|
||||||
|
|
||||||
.PARAMETER RunspaceDefinition
|
```
|
||||||
Your parameter description
|
Invoke-PSThread -InputObjectList <Object[]> -RunspaceDefinition <ScriptBlock> [-ApartmentState <ApartmentState>] [-AssemblyList <SessionStateAssemblyEntry[]>] [-Confirm] [-ContinueOnError] [-FunctionList <FunctionInfo[]>] [-MaximumRunspaces <UInt32>] [-ModuleList <PSModuleInfo[]>] [-RunspaceParameters <Hashtable>] [-RunspacePool] [-SynchronizedHashtable <PSVariable>] [-ThreadOption <PSThreadOptions>] [-VariableList <PSVariable[]>] [-WaitForAvailableRunspace] [-WhatIf] [<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
.PARAMETER RunspaceParameters
|
### Await
|
||||||
Your parameter description
|
|
||||||
|
|
||||||
.PARAMETER InputObjectList
|
```
|
||||||
Your parameter description
|
Invoke-PSThread -ThreadList <PSObject[]> [-Await] [-Confirm] [-ContinueOnError] [-LoopDuration <TimeSpan>] [-LoopTimeout <TimeSpan>] [-WaitForAvailableRunspace] [-WhatIf] [<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
.PARAMETER SynchronizedHashtable
|
## DESCRIPTION
|
||||||
Your parameter description
|
|
||||||
|
|
||||||
.PARAMETER AssemblyList
|
This function aims to remove the enormous complexity out of multithreading within powershell.
|
||||||
Your parameter description
|
See the fully working examples below.
|
||||||
|
|
||||||
.PARAMETER FunctionList
|
|
||||||
Your parameter description
|
|
||||||
|
|
||||||
.PARAMETER ModuleList
|
## EXAMPLES
|
||||||
Your parameter description
|
|
||||||
|
|
||||||
.PARAMETER VariableList
|
### Example 1: EXAMPLE 1
|
||||||
Your parameter description
|
|
||||||
|
|
||||||
.PARAMETER ThreadList
|
```
|
||||||
Your parameter description
|
|
||||||
|
|
||||||
.PARAMETER LoopTimeout
|
|
||||||
Your parameter description
|
|
||||||
|
|
||||||
.PARAMETER LoopDuration
|
|
||||||
Your parameter description
|
|
||||||
|
|
||||||
.PARAMETER WaitForAvailableRunspace
|
|
||||||
Your parameter description
|
|
||||||
|
|
||||||
.PARAMETER ContinueOnError
|
|
||||||
Your parameter description
|
|
||||||
|
|
||||||
.EXAMPLE
|
|
||||||
Create a runspace
|
Create a runspace
|
||||||
|
```
|
||||||
|
|
||||||
[ScriptBlock]$RunspaceDefinition = {
|
[ScriptBlock]$RunspaceDefinition = {
|
||||||
Param
|
Param
|
||||||
@@ -88,7 +77,7 @@
|
|||||||
$InvokePSThreadParameters = New-Object -TypeName 'System.Collections.Specialized.OrderedDictionary'
|
$InvokePSThreadParameters = New-Object -TypeName 'System.Collections.Specialized.OrderedDictionary'
|
||||||
$InvokePSThreadParameters.Runspace = $True
|
$InvokePSThreadParameters.Runspace = $True
|
||||||
$InvokePSThreadParameters.RunspaceDefinition = $RunspaceDefinition
|
$InvokePSThreadParameters.RunspaceDefinition = $RunspaceDefinition
|
||||||
$InvokePSThreadParameters.RunspaceParameters = New-Object -TypeName 'System.Collections.Specialized.OrderedDictionary'
|
$InvokePSThreadParameters.RunspaceParameters = [Ordered]@{}
|
||||||
$InvokePSThreadParameters.RunspaceParameters.Title = "This is my UI title"
|
$InvokePSThreadParameters.RunspaceParameters.Title = "This is my UI title"
|
||||||
$InvokePSThreadParameters.RunspaceParameters.Message = "This is my UI message.`r`nThis is the second line of my UI message.`r`nThis is the third line of my UI message."
|
$InvokePSThreadParameters.RunspaceParameters.Message = "This is my UI message.`r`nThis is the second line of my UI message.`r`nThis is the third line of my UI message."
|
||||||
$InvokePSThreadParameters.SynchronizedHashtable = Get-Variable -Name 'SynchronizedHashtable' -ErrorAction SilentlyContinue
|
$InvokePSThreadParameters.SynchronizedHashtable = Get-Variable -Name 'SynchronizedHashtable' -ErrorAction SilentlyContinue
|
||||||
@@ -102,8 +91,15 @@
|
|||||||
|
|
||||||
Write-Output -InputObject ($InvokePSThreadResult)
|
Write-Output -InputObject ($InvokePSThreadResult)
|
||||||
|
|
||||||
.EXAMPLE
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Example 2: EXAMPLE 2
|
||||||
|
|
||||||
|
```
|
||||||
Create a runspace pool, submit all jobs to the pool, and the pool will manage their execution.
|
Create a runspace pool, submit all jobs to the pool, and the pool will manage their execution.
|
||||||
|
```
|
||||||
|
|
||||||
[ScriptBlock]$RunspaceDefinition = {
|
[ScriptBlock]$RunspaceDefinition = {
|
||||||
Param
|
Param
|
||||||
@@ -123,7 +119,8 @@
|
|||||||
|
|
||||||
$SynchronizedHashtable.ThreadIDList.Add($ThreadID)
|
$SynchronizedHashtable.ThreadIDList.Add($ThreadID)
|
||||||
|
|
||||||
Write-Verbose -Message "Attempting to begin thread ID `"$($ThreadID)`". Please Wait..." -Verbose
|
Write-Verbose -Message "Attempting to begin thread ID `"$($ThreadID)`".
|
||||||
|
Please Wait..." -Verbose
|
||||||
|
|
||||||
$SynchronizedHashtable.Add("Thread$($ThreadID)", (Get-Date))
|
$SynchronizedHashtable.Add("Thread$($ThreadID)", (Get-Date))
|
||||||
|
|
||||||
@@ -143,7 +140,7 @@
|
|||||||
$InvokePSThreadParameters.RunspacePool = $True
|
$InvokePSThreadParameters.RunspacePool = $True
|
||||||
$InvokePSThreadParameters.InputObjectList = 1..15
|
$InvokePSThreadParameters.InputObjectList = 1..15
|
||||||
$InvokePSThreadParameters.RunspaceDefinition = $RunspaceDefinition
|
$InvokePSThreadParameters.RunspaceDefinition = $RunspaceDefinition
|
||||||
$InvokePSThreadParameters.RunspaceParameters = New-Object -TypeName 'System.Collections.Specialized.OrderedDictionary'
|
$InvokePSThreadParameters.RunspaceParameters = [Ordered]@{}
|
||||||
$InvokePSThreadParameters.RunspaceParameters.AdditionalParameter1 = Get-Random -Minimum 0 -Maximum 10000
|
$InvokePSThreadParameters.RunspaceParameters.AdditionalParameter1 = Get-Random -Minimum 0 -Maximum 10000
|
||||||
$InvokePSThreadParameters.RunspaceParameters.AdditionalParameter2 = Get-Random -Minimum 0 -Maximum 10000
|
$InvokePSThreadParameters.RunspaceParameters.AdditionalParameter2 = Get-Random -Minimum 0 -Maximum 10000
|
||||||
$InvokePSThreadParameters.SynchronizedHashtable = Get-Variable -Name 'SynchronizedHashtable' -ErrorAction SilentlyContinue
|
$InvokePSThreadParameters.SynchronizedHashtable = Get-Variable -Name 'SynchronizedHashtable' -ErrorAction SilentlyContinue
|
||||||
@@ -157,8 +154,15 @@
|
|||||||
|
|
||||||
Write-Output -InputObject ($InvokePSThreadResult)
|
Write-Output -InputObject ($InvokePSThreadResult)
|
||||||
|
|
||||||
.EXAMPLE
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Example 3: EXAMPLE 3
|
||||||
|
|
||||||
|
```
|
||||||
Create a runspace pool, submit all jobs to the pool, and the pool will manage their execution. The function will be executed a second time to wait until all jobs have been completed, return their output, and cleanup.
|
Create a runspace pool, submit all jobs to the pool, and the pool will manage their execution. The function will be executed a second time to wait until all jobs have been completed, return their output, and cleanup.
|
||||||
|
```
|
||||||
|
|
||||||
[ScriptBlock]$RunspaceDefinition = {
|
[ScriptBlock]$RunspaceDefinition = {
|
||||||
Param
|
Param
|
||||||
@@ -178,7 +182,8 @@
|
|||||||
|
|
||||||
$SynchronizedHashtable.ThreadIDList.Add($ThreadID)
|
$SynchronizedHashtable.ThreadIDList.Add($ThreadID)
|
||||||
|
|
||||||
Write-Verbose -Message "Attempting to begin thread ID `"$($ThreadID)`". Please Wait..." -Verbose
|
Write-Verbose -Message "Attempting to begin thread ID `"$($ThreadID)`".
|
||||||
|
Please Wait..." -Verbose
|
||||||
|
|
||||||
$SynchronizedHashtable.Add("Thread$($ThreadID)", (Get-Date))
|
$SynchronizedHashtable.Add("Thread$($ThreadID)", (Get-Date))
|
||||||
|
|
||||||
@@ -198,7 +203,7 @@
|
|||||||
$InvokePSThreadParameters.RunspacePool = $True
|
$InvokePSThreadParameters.RunspacePool = $True
|
||||||
$InvokePSThreadParameters.InputObjectList = Get-Process | Get-Random -Count 15
|
$InvokePSThreadParameters.InputObjectList = Get-Process | Get-Random -Count 15
|
||||||
$InvokePSThreadParameters.RunspaceDefinition = $RunspaceDefinition
|
$InvokePSThreadParameters.RunspaceDefinition = $RunspaceDefinition
|
||||||
$InvokePSThreadParameters.RunspaceParameters = New-Object -TypeName 'System.Collections.Specialized.OrderedDictionary'
|
$InvokePSThreadParameters.RunspaceParameters = [Ordered]@{}
|
||||||
$InvokePSThreadParameters.RunspaceParameters.AdditionalParameter1 = Get-Random -Minimum 0 -Maximum 10000
|
$InvokePSThreadParameters.RunspaceParameters.AdditionalParameter1 = Get-Random -Minimum 0 -Maximum 10000
|
||||||
$InvokePSThreadParameters.RunspaceParameters.AdditionalParameter2 = Get-Random -Minimum 0 -Maximum 10000
|
$InvokePSThreadParameters.RunspaceParameters.AdditionalParameter2 = Get-Random -Minimum 0 -Maximum 10000
|
||||||
$InvokePSThreadParameters.SynchronizedHashtable = Get-Variable -Name 'SynchronizedHashtable' -ErrorAction SilentlyContinue
|
$InvokePSThreadParameters.SynchronizedHashtable = Get-Variable -Name 'SynchronizedHashtable' -ErrorAction SilentlyContinue
|
||||||
@@ -224,23 +229,418 @@
|
|||||||
|
|
||||||
Write-Output -InputObject ($ThreadAwaitResult)
|
Write-Output -InputObject ($ThreadAwaitResult)
|
||||||
|
|
||||||
.NOTES
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## PARAMETERS
|
||||||
|
|
||||||
|
### -ApartmentState
|
||||||
|
|
||||||
|
A valid apartment state that will be used to create each thread within the runspace.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: ApartmentState
|
||||||
|
Parameter Sets: RunspacePool, Runspace
|
||||||
|
Aliases: AS
|
||||||
|
Accepted values:
|
||||||
|
|
||||||
|
Required: True (None) False (RunspacePool, Runspace)
|
||||||
|
Position: Named
|
||||||
|
Default value:
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
DontShow: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -AssemblyList
|
||||||
|
|
||||||
|
A list of one or more additional assemblies that will be loaded into the inital session state, and made available to each thread.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: SessionStateAssemblyEntry[]
|
||||||
|
Parameter Sets: RunspacePool, Runspace
|
||||||
|
Aliases: AL
|
||||||
|
Accepted values:
|
||||||
|
|
||||||
|
Required: True (None) False (RunspacePool, Runspace)
|
||||||
|
Position: Named
|
||||||
|
Default value:
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
DontShow: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -Await
|
||||||
|
|
||||||
|
Strictly places this function into "Await" mode.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: SwitchParameter
|
||||||
|
Parameter Sets: Await
|
||||||
|
Aliases: AW
|
||||||
|
Accepted values:
|
||||||
|
|
||||||
|
Required: True (None) False (Await)
|
||||||
|
Position: Named
|
||||||
|
Default value: False
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
DontShow: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -Confirm
|
||||||
|
|
||||||
|
{{ Fill Confirm Description }}
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: SwitchParameter
|
||||||
|
Parameter Sets: (All)
|
||||||
|
Aliases: cf
|
||||||
|
Accepted values:
|
||||||
|
|
||||||
|
Required: True (None) False (All)
|
||||||
|
Position: Named
|
||||||
|
Default value:
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
DontShow: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -ContinueOnError
|
||||||
|
|
||||||
|
Ignore errors.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: SwitchParameter
|
||||||
|
Parameter Sets: (All)
|
||||||
|
Aliases: COE
|
||||||
|
Accepted values:
|
||||||
|
|
||||||
|
Required: True (None) False (All)
|
||||||
|
Position: Named
|
||||||
|
Default value: False
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
DontShow: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -FunctionList
|
||||||
|
|
||||||
|
A list of one or more additional functions that will be loaded into the inital session state, and made available to each thread.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: FunctionInfo[]
|
||||||
|
Parameter Sets: RunspacePool, Runspace
|
||||||
|
Aliases: FL
|
||||||
|
Accepted values:
|
||||||
|
|
||||||
|
Required: True (None) False (RunspacePool, Runspace)
|
||||||
|
Position: Named
|
||||||
|
Default value:
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
DontShow: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -InputObjectList
|
||||||
|
|
||||||
|
A list of one or more objects to submit to the runspace pool.
|
||||||
|
The runspace pool will create a job for each item and process them in a queue fashion (As new runspaces become available) until the list has been completed.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: Object[]
|
||||||
|
Parameter Sets: RunspacePool
|
||||||
|
Aliases: IOL
|
||||||
|
Accepted values:
|
||||||
|
|
||||||
|
Required: True (RunspacePool) False (None)
|
||||||
|
Position: Named
|
||||||
|
Default value:
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
DontShow: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -LoopDuration
|
||||||
|
|
||||||
|
A valid timespan that will be used for designating how often to recheck the status of running threads.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: TimeSpan
|
||||||
|
Parameter Sets: Await
|
||||||
|
Aliases: LD
|
||||||
|
Accepted values:
|
||||||
|
|
||||||
|
Required: True (None) False (Await)
|
||||||
|
Position: Named
|
||||||
|
Default value:
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
DontShow: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -LoopTimeout
|
||||||
|
|
||||||
|
A valid timespan that will be used for designating the maximum time allowed to monitor running threads.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: TimeSpan
|
||||||
|
Parameter Sets: Await
|
||||||
|
Aliases: LT
|
||||||
|
Accepted values:
|
||||||
|
|
||||||
|
Required: True (None) False (Await)
|
||||||
|
Position: Named
|
||||||
|
Default value:
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
DontShow: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -MaximumRunspaces
|
||||||
|
|
||||||
|
The maximum runspaces available to the runspace pool.
|
||||||
|
By default, the value will be set to double the amount of logical processors available to the current device.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: UInt32
|
||||||
|
Parameter Sets: RunspacePool
|
||||||
|
Aliases: MR
|
||||||
|
Accepted values:
|
||||||
|
|
||||||
|
Required: True (None) False (RunspacePool)
|
||||||
|
Position: Named
|
||||||
|
Default value: 0
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
DontShow: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -ModuleList
|
||||||
|
|
||||||
|
A list of one or more additional modules that will be loaded into the inital session state, and made available to each thread.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: PSModuleInfo[]
|
||||||
|
Parameter Sets: RunspacePool, Runspace
|
||||||
|
Aliases: ML
|
||||||
|
Accepted values:
|
||||||
|
|
||||||
|
Required: True (None) False (RunspacePool, Runspace)
|
||||||
|
Position: Named
|
||||||
|
Default value:
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
DontShow: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -Runspace
|
||||||
|
|
||||||
|
Strictly places this function into "Runspace" mode.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: SwitchParameter
|
||||||
|
Parameter Sets: Runspace
|
||||||
|
Aliases: RS
|
||||||
|
Accepted values:
|
||||||
|
|
||||||
|
Required: True (None) False (Runspace)
|
||||||
|
Position: Named
|
||||||
|
Default value: False
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
DontShow: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -RunspaceDefinition
|
||||||
|
|
||||||
|
A valid scriptblock that will be executed by either a single thread within the runspace, or by each thread within the runspace pool.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: ScriptBlock
|
||||||
|
Parameter Sets: RunspacePool, Runspace
|
||||||
|
Aliases: RD
|
||||||
|
Accepted values:
|
||||||
|
|
||||||
|
Required: True (RunspacePool, Runspace) False (None)
|
||||||
|
Position: Named
|
||||||
|
Default value:
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
DontShow: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -RunspaceParameters
|
||||||
|
|
||||||
|
A valid hashtable containing the key-value pairs for the additional parameters to be passed to each thread.
|
||||||
|
If the order of the parameters needs to be preserved, use an ordered hashtable instead.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: Hashtable
|
||||||
|
Parameter Sets: RunspacePool, Runspace
|
||||||
|
Aliases: RSP
|
||||||
|
Accepted values:
|
||||||
|
|
||||||
|
Required: True (None) False (RunspacePool, Runspace)
|
||||||
|
Position: Named
|
||||||
|
Default value:
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
DontShow: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -RunspacePool
|
||||||
|
|
||||||
|
Strictly places this function into "RunspacePool" mode.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: SwitchParameter
|
||||||
|
Parameter Sets: RunspacePool
|
||||||
|
Aliases: RP
|
||||||
|
Accepted values:
|
||||||
|
|
||||||
|
Required: True (None) False (RunspacePool)
|
||||||
|
Position: Named
|
||||||
|
Default value: False
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
DontShow: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -SynchronizedHashtable
|
||||||
|
|
||||||
|
A valid variable object that contains the synchronized hashtable.
|
||||||
|
This is primarily used to share data between the main thread, and any additional threads that are created.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: PSVariable
|
||||||
|
Parameter Sets: RunspacePool, Runspace
|
||||||
|
Aliases: SHT
|
||||||
|
Accepted values:
|
||||||
|
|
||||||
|
Required: True (None) False (RunspacePool, Runspace)
|
||||||
|
Position: Named
|
||||||
|
Default value:
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
DontShow: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -ThreadList
|
||||||
|
|
||||||
|
A list of one ore more objects that were returned in the output from a previous call of this function.
|
||||||
|
The runspaces in this list will be monitored until they have completed.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: PSObject[]
|
||||||
|
Parameter Sets: Await
|
||||||
|
Aliases: TL
|
||||||
|
Accepted values:
|
||||||
|
|
||||||
|
Required: True (Await) False (None)
|
||||||
|
Position: Named
|
||||||
|
Default value:
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
DontShow: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -ThreadOption
|
||||||
|
|
||||||
|
A valid thread option that will be used to create each thread within the runspace.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: PSThreadOptions
|
||||||
|
Parameter Sets: RunspacePool, Runspace
|
||||||
|
Aliases: TO
|
||||||
|
Accepted values:
|
||||||
|
|
||||||
|
Required: True (None) False (RunspacePool, Runspace)
|
||||||
|
Position: Named
|
||||||
|
Default value:
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
DontShow: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -VariableList
|
||||||
|
|
||||||
|
A list of one or more additional variables that will be loaded into the inital session state, and made available to each thread.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: PSVariable[]
|
||||||
|
Parameter Sets: RunspacePool, Runspace
|
||||||
|
Aliases: VL
|
||||||
|
Accepted values:
|
||||||
|
|
||||||
|
Required: True (None) False (RunspacePool, Runspace)
|
||||||
|
Position: Named
|
||||||
|
Default value:
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
DontShow: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -WaitForAvailableRunspace
|
||||||
|
|
||||||
|
If there are no more available runspaces, the function will wait to submit any additional jobs to teh runspace pool as runspaces become available.
|
||||||
|
This will drastically increase the time it takes to process the runspace pool.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: SwitchParameter
|
||||||
|
Parameter Sets: (All)
|
||||||
|
Aliases: WFAR
|
||||||
|
Accepted values:
|
||||||
|
|
||||||
|
Required: True (None) False (All)
|
||||||
|
Position: Named
|
||||||
|
Default value: False
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
DontShow: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -WhatIf
|
||||||
|
|
||||||
|
{{ Fill WhatIf Description }}
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: SwitchParameter
|
||||||
|
Parameter Sets: (All)
|
||||||
|
Aliases: wi
|
||||||
|
Accepted values:
|
||||||
|
|
||||||
|
Required: True (None) False (All)
|
||||||
|
Position: Named
|
||||||
|
Default value:
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
DontShow: False
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### CommonParameters
|
||||||
|
|
||||||
|
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||||
|
|
||||||
|
## NOTES
|
||||||
|
|
||||||
Any useful tidbits
|
Any useful tidbits
|
||||||
|
|
||||||
.LINK
|
|
||||||
https://davewyatt.wordpress.com/2014/04/29/more-potential-use-cases-for-thread-safe-variable-access-in-powershell-events/
|
|
||||||
|
|
||||||
.LINK
|
## RELATED LINKS
|
||||||
https://davewyatt.wordpress.com/2014/04/29/more-potential-use-cases-for-thread-safe-variable-access-in-powershell-events/
|
|
||||||
|
|
||||||
.LINK
|
[] (https://davewyatt.wordpress.com/2014/04/29/more-potential-use-cases-for-thread-safe-variable-access-in-powershell-events/)
|
||||||
https://www.codeproject.com/Tips/895840/Multi-Threaded-PowerShell-Cookbook
|
|
||||||
|
|
||||||
.LINK
|
[] (https://davewyatt.wordpress.com/2014/04/29/more-potential-use-cases-for-thread-safe-variable-access-in-powershell-events/)
|
||||||
https://www.linkedin.com/pulse/multithreading-powershell-scripts-alexey/
|
|
||||||
|
|
||||||
.LINK
|
[] (https://www.codeproject.com/Tips/895840/Multi-Threaded-PowerShell-Cookbook)
|
||||||
https://xkln.net/blog/multithreading-in-powershell--running-a-specific-number-of-threads/
|
|
||||||
|
[] (https://www.linkedin.com/pulse/multithreading-powershell-scripts-alexey/)
|
||||||
|
|
||||||
|
[] (https://xkln.net/blog/multithreading-in-powershell--running-a-specific-number-of-threads/)
|
||||||
|
|
||||||
|
[] (https://markw.dev/#:~:text=There%20are%20two%20ways%20we,other%20is%20by%20using%20splatting.&text=The%20important%20part%20here%20is,plural)%20instead%20of%20AddParameter()%20.)
|
||||||
|
|
||||||
.LINK
|
|
||||||
https://markw.dev/#:~:text=There%20are%20two%20ways%20we,other%20is%20by%20using%20splatting.&text=The%20important%20part%20here%20is,plural)%20instead%20of%20AddParameter()%20.
|
|
||||||
|
|||||||
Reference in New Issue
Block a user