Para agilizar las clonaciones de listas de máquinas, es necesario usar un powercli, que, además, elija como destino el datastore que tenga mayor espacio disponible.
Para ordenar los resultados de datastore en función del espacio disponible:
$datastorelist = Get-Datastore -Location $DatastoreCluster | sort -descending FreeSpaceMB
En nuestro caso, tenemos los datastore configurados como un datastorecluster, pero,en el caso de no tener, podríamos usar como Location directamente el nombre del cluster o del datacenter donde queremos seleccionar el datastore.
El script completo, está disponible en github.
foreach ($clonename in $new_vm) { #Select datastore with more space: # $datastorelist = Get-Datastore -Location $Datacenter | sort -descending FreeSpaceMB # Use in case there are datastore clusters $datastorelist = Get-Datastore -Location $DatastoreCluster | sort -descending FreeSpaceMB $datastore = $datastorelist[0].Name "Clone $clonename in $datastore" if (New-VM -Name $clonename -ResourcePool $respool -VM $sourceVM -Location $folder -Datastore $datastore -DiskStorageFormat Thick ) {"DONE $clonename"} else {"Something wrong with cloning"} }
That’s really thinking out of the box. Thanks!
Stellar work there everyone. I’ll keep on reading.
Stephanie….STEPHANIE! This post is so amazing and cute, I just Twittered it!!! I foresee a girls date with you, me, and Lyssa. Take this virtual friendship to the next level why don’t we. Whaddaya say?
Don’t you just love the way these guys think? It’s like when the O-man was running for Senate in Illinois and the GOP’s candidate crashed and burned. Who did they get to run then? That walking freak-show Alan Keyes, who didn’t even live in Illinois!
, “I think he would be better off being at home having dinner and cooking a meal with his family.” Now, after hearing your rant, I think I was right. I would love some input on the issue of time and cooking …
“Stront in je broek” is the only Dutch phrase I learned in grade school from my Dutch friends; well, that and, “Ya ain’t Dutch, ya ain’t much.”Have fun with all the ex-pats!Love ya!