PowerCLI get list of vMotion IP’s in use

A good friend of mine who’s powershell foo is much stronger than mine shared this snip of powershell.  It can be used to collect the IP addresses of your vMotion interfaces.  It’s pretty much run and go.

 

$Array = @()

$Clusters = Get-Cluster | Sort Name

ForEach ($Cluster in $Clusters){

$VmHosts = $Cluster | Get-VmHost | Where {$_.ConnectionState -eq “Connected”} | Sort Name

ForEach ($VmHost in $VmHosts){

$Array += Get-VMHostNetworkAdapter -VMHost $VmHost.Name -VMKernel | Where {$_.VMotionEnabled -eq “True”} | select VmHost,IP

}

}

$Array | Out-GridView

 

That’s pretty much it.  You can adjust the Out-GridView to something else if you want Export-CSV.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.