- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You could if you wanted to, but vCenter will normally throttle itself. So you could have all 50 queued up and only a subset of those would actually be active jobs.
One method would be to introduce an arbitrary count and sleep method. Or another more accurate, but would require a bit more coding would be to look @ the tasks and only start another job if the active task count is less than 4 or 5.
Here is the first method as an example:
$filepath = "D:\PathtoCSV\filename.csv
$csvobj = import-csv $filepath
$Count = 4
foreach ($row in $csvobj) {
$Count --
$vmobj = get-vm $row.vmname
$ds = get-datastore $row.destds
$vmobj | move-vm -datastore $ds -runasync -confirm:$false
If ($Count -lt 0){Sleep 1500; $Count = 4}
}
Chris Nakagaki (中垣浩一)
Blog: https://tech.zsoldier.com
Twitter: @zsoldier
Blog: https://tech.zsoldier.com
Twitter: @zsoldier