I have been using a simple bit of code to wait for drives to be added 'hot' in a mutli-writer shared VM situation. Below is an example of the code I have been using for a few years now.
$task = $vmview.ReconfigVM_Task($spec)
$task1 = Get-Task -Id ("Task-$($task.value)")
$task1 | Wait-Task
The reconfigVM_task $spec is pre-loaded with all the required info and then submitted on the first line. The task info is usually retrieved there and then I can wait for it to complete. Apparently, in vsphere 7, the task info is not being passed. I use this to wait for the disk creation task to complete before I add it to the sharing VMs. The trouble is, in vsphere 7, the task information is not returned and the script then skips to adding the disk to the partner VMs and that fails. Course this creates a bit of a mess and manual clean-up is required. Adding to the mix is that we are using VSAN a good bit now and disk creation can take time there depending on the storage policy applied.
My question is, is there another method that works to wait for the task to complete? I have not been able to find anything yet. Any help would be great.