title: Powershell 3.0 - Workflows - Limit number of parallel execution
body: <p>I am cloning VMs on ESX server from template. Simplified code looks like this:</p>
  
  <pre><code>Workflow Create-VM {
    $List = 1..500
    foreach -parallel ($Elem in $List)
    {
        # Create VM ...
        # Configure created VM ..
    }
  }
  
  Create-VM
  </code></pre>
  
  <p>Parallel execution is really helpful. Unfortunately in this case doesn't work pretty well. Too many parallel request are generated. I need to limit number of parallel execution to smaller number (for example 4).</p>
  
  <p>I was trying to change local Session Configuration (SessionThrottleLimit, MaxSessionsPerWorkflow, MaxRunningWorkflows) <a href="http://technet.microsoft.com/en-us/library/hh849862.aspx" rel="noreferrer">http://technet.microsoft.com/en-us/library/hh849862.aspx</a>.  </p>
  
  <pre><code>$WWE = New-PSWorkflowExecutionOption  -SessionThrottleLimit 4
  Set-PSSessionConfiguration -Name microsoft.powershell.workflow `
     -SessionTypeOption $WWE 
  Get-PSSessionConfiguration microsoft.powershell.workflow | 
  fl SessionThrottleLimit
  </code></pre>
  
  <p><strong>Question</strong></p>
  
  <ul>
  <li>Which parameter (or combination) of Session Configuration should I change, in order to limit the number of parallel execution to 4?</li>
  <li>Is there some other method how can I achieve that (For example: different way to execute workflow ...)?</li>
  </ul>