Retrieve IP and Gateway for the VMkernel with Enabled services equal to vMotion
vCenter server 7.x, 8.x
PowerCLI 12.x, 13.x
PowerCLI script:
Connect-VIServer -Server "vCIP/FQDN" -User "username" -Password "password"
$vmhost =Get-VMHost -Name "host_name"
#Get vMotion IP
Get-VMHostNetworkAdapter -VMHost $VmHost -VMKernel | select IP | where VMotionEnabled -eq $True
#Get vMotion Gateway
$networkConfig = Get-VMHostNetwork -VMHost $vmhost
$networkConfig.ExtensionData2.networkinfo.NetStackInstance | Where-Object {$_.Name -like "*vMotion*" } | Select -ExpandProperty iprouteconfig | select DefaultGateway | Select -ExpandProperty DefaultGateway