Hi,
I am trying to come up with a script which will get all of the VMs from a data store cluster. Then based on the host they are on create one queue per unique host. Finally then kick off one svMotion per host at a time. The goal is for a controlled migration of VMs off of an old data store cluster onto a new on.
I got the easy part of getting all the VMs $AllVMsInDatastoreCluster = Get-DatastoreCluster - Name | Get-VM.
I know logically I will need a different list per host within the cluster and want to load up the VMs based on the value in $AllVMsInDatastoreCluster[x].Host.Name
I was hoping to use Group-Object to create the groups, but then I do not know how to reference the groups after I have them, to start one svMotion per host. So that all of the hosts will have one svMotion occurring at a time until all of the VMs in each of the groups have been migrated. So if there is 10 hosts there are 10 svMotions occurring at once.