VMware Cloud Community
tickermcse76
Contributor
Contributor

What is the best way to track the status of a VM host vMotion and confirm whether the status is completed?

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?

Reply
0 Kudos
1 Reply
LucD
Leadership
Leadership

You can look for the VmMigratedEventwith Get-ViEvent.

Something similar to what I did in Get the vMotion/svMotion history


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos