Below script can help you to get the count of all vMotion events that has happened in the past 24 hrs.

If you want to calculate the count for longer period then change the number AddDays.

Get-VIEvent -Entity (Get-VM -Location $_) -MaxSamples ([int]::MaxValue) -Start (Get-Date).AddDays(-1) |
Where { $_.GetType().Name -eq “TaskEvent” -and $_.Info.DescriptionId -eq “VirtualMachine.migrate”} |
Measure-Object | Select-Object -ExpandProperty Count

Posted in: Vmware.
Last Modified: January 12, 2017

Leave a reply