Hi!
I have multiple VMs with different number of disks and different datastores.
Now i wont use storage vmotion to move all disk to one datastore.
Then i use move-harddisk to move every HD with Storage Format EagerZeroedThick.
At the same time, the hard drives are moved to their original datastores.
How can I call each element of the array in a loop?
$vmhddsorigs = Get-VM mytest | Get-HardDisk
Move-VM -VM mytest -Datastore mydatastore1 -RunAsync
foreach ($vmhddsorigs in $vmhddsorig) {
$disknname=$_.diskname
$diskds=$_.datastore.name
get-vm mytest | Move-HardDisk -HardDisk $disknname -Datastore $diskds -StorageFormat EagerZeroedThick
}