I am cloning virtual machines on an ESX server from a template. The simplified code is as follows:
Workflow Create-VM {
$List = 1..500
foreach -parallel ($Elem in $List)
{
}
}
Create-VM
Parallel execution is really useful. Unfortunately, in this case this does not work very well. Too many concurrent queries generated. I need to limit the parallel execution number to a smaller number (e.g. 4).
I tried to change the local session configuration (SessionThrottleLimit, MaxSessionsPerWorkflow, MaxRunningWorkflows) http://technet.microsoft.com/en-us/library/hh849862.aspx .
$WWE = New-PSWorkflowExecutionOption -SessionThrottleLimit 4
Set-PSSessionConfiguration -Name microsoft.powershell.workflow `
-SessionTypeOption $WWE
Get-PSSessionConfiguration microsoft.powershell.workflow |
fl SessionThrottleLimit
Question
- What parameter (or combination) of the session configuration should be changed to limit the number of concurrent operations to 4?
- - , (: ...)?