Skip to content

Instantly share code, notes, and snippets.

@jeffgreenca
Last active December 2, 2016 17:24
Show Gist options
  • Save jeffgreenca/b384a238e5c453f50d7b to your computer and use it in GitHub Desktop.
Save jeffgreenca/b384a238e5c453f50d7b to your computer and use it in GitHub Desktop.
#vmotion-validation-test.ps1
#vMotion a VM over all hosts in a cluster, twice.
$cluster = Read-Host "Cluster Name"
$vm = Read-Host "Test VM Name"
function validate-vmotion($cluster, $vm) {
$totalms = 0
$count = 0
get-cluster $cluster | get-vmhost | foreach {
$duration = Measure-Command {
move-vm -Destination $_ -VM $vm -Confirm:$false
}
echo "vMotion Completed in $($duration.TotalSeconds)s"
$totalms = $totalms + $duration.TotalMilliseconds
$count = $count + 1
}
echo "Total Time (ms): $totalms"
echo ("Average Time (ms): " + ($totalms / $count))
}
validate-vmotion -cluster $cluster -vm $vm
validate-vmotion -cluster $cluster -vm $vm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment