I have a PowerCLI script which vMotions a set of VM's from one cluster to another, done asynchronously. Now I need to run a post check to confirm the vMotion tasks were successful. Using Get-Task, I can see the status of vMotion tasks change to "completed" and cross reference the Id back to the VM name. The main downside to Get-Task is the objects expire after 10 minutes. In my use case this really shouldn't be an issue as I'm vMotioning at most 15-20 VM's and the Get-Task history should contain all the information I need.
But I would prefer to not rely on that condition if possible. I was looking at Get-VIEvent as an alternative, but it appears the state object property is always locked in "queued" state even long after the job has completed. Is there way to get "completed" status from Get-VIEvent or another other cmdlets?