A very simple and straightforward brake system :-)
## Deploy VMs from CSV File ## Much borrowed from http://communities.vmware.com/thread/315193?start=15&tstart=0$maxJobs=3
$currentJobs=0
## Imports CSV fileImport-Csv"C:\temp\TestDeploy1"-UseCulture|%{## Gets Customization info to set NIC to Static and assign static IP address Get-OSCustomizationSpec$_.Customization|Get-OSCustomizationNicMapping|`
## Sets the Static IP info Set-OSCustomizationNicMapping-IpModeUseStaticIP-IpAddress$_."IP Address"`
-SubnetMask$_.Subnet-DefaultGateway$_.Gateway-Dns$_.DNS
## Sets the name of the VMs OS $cust=Get-OSCustomizationSpec-NameTest
Set-OSCustomizationSpec-OSCustomizationSpec$cust-NamingSchemeFixed-NamingPrefix$_.VMName
## Creates the New VM from the template $vm=New-VM-Name$_."Server Name"-Template$_.Template-Host$_."Esx Host"`
-Datastore$_.Datastore-OSCustomizationSpec$_.Customization`
-Confirm:$false-RunAsync
$currentJobs=Get-Job-StateRunning|Measure-Object|Select-ExpandPropertyCount
while($currentJobs-ge$maxJobs){ sleep30
$currentJobs=Get-Job-StateRunning|Measure-Object|Select-ExpandPropertyCount
}## .......}
You can be more selective on getting the current jobs. You could for example check if the name of the jobs shows that they are actually cloning jobs.