Now Where Did I Put My VMotion?

Let’s say you have a metric heck ton of hosts, and you need to check them… all. To see if VMotion has been enabled properly. How do you do it?

Well, you could hire that out of work banker now out in front of the grocery store to come and click through all of the hosts in your VI environment. Or… You could look it up with PowerShell. So without further adieu:

> get-vmhost | get-vmhostnetwork | select-object -expandProperty VirtualNic | Select VmotionEnabled

VMotionEnabled
————–
True

Well, my “lab” has only a single host. Against 100, you would see either True or False 100 times, which while it is the information you’re looking for, really isn’t all that useful without the host names in it, now is it?

Lets do this instead:

> get-vmhost | .Get-VMotion.ps1

name            vmotion
—-            ——-
192.168.15.253  True

Well… spiffy, no? What’s in this magical Get-VMotion.ps1? Well first, clicking it’s name back there should lead you to a download of sorts. If that’s not to your fancy, then here is some copy/paste magic for you:

Process {
if ( $_ -isnot [VMware.VimAutomation.Client20.VMHostImpl] ) {
Write-Error “VMHost expected, skipping object in pipeline.”
continue
}
$PropertyCol = @( “name”, “vmotion” )
$vmh = “” | Select-Object -Property $PropertyCol
$vmh.name = $_.Name
$vmh.vmotion = $_ | Get-VMHostNetwork | select-object -expandProperty VirtualNic | %{$_.VmotionEnabled}
$vmh
}

All except the ugly formatting of course 🙂 That is purely my own. Enjoy in good health, and if you have any questions, leave them in the comments, or hit me up on Twitter @cody_bunch . Peace … through VMotion.

4 thoughts on “Now Where Did I Put My VMotion?

Comments are closed.