Documentation – ESXi Host vMotion IPs

I’ve recently had to audit and document several vSphere environments.  Multiple hosts had been configured manually and there were some mistakes in the IP settings.  I put together this POWERCLI function to report back on these settings and will now use it for documentation moving forward.  Hopefully of some use to others too.

Connect to a host or vCenter and give it a go.

 

function Get-HostvMotionIP {
Param (

[string]$ESX = '*'

)

<#
.Synopsis
The Get-HostvMotionIP retrieves CW Document Information regarding iSCSI IP Addresses of ESXi hosts
.EXAMPLE
Get-HostvMotionIP  
.EXAMPLE
Get-HostvMotionIP -ESX "esx1.domian.com","esx2.domain.com"
.EXAMPLE
$vMotionIPinfo = Get-HostvMotionIP | out-gridview -title vMotion IPs
.NOTES
Chris Tucker 
@CT_Technical
#>

$myesxihosts = Get-VMHost $ESX
 
## vMotion

$vMotionAudit = @()

foreach ($VMHost in $myesxihosts) {

$vmnics = (Get-VMHostNetwork -VMHost $VMHost.name).virtualnic | where {$_.VMotionEnabled -eq $true} | Sort-Object -Property Name 

foreach ($vmnic in $vmnics) {
$vMotionDetails = New-Object PSObject
$vMotionDetails | Add-Member -name "Hostname" -Value $VMHost.name -MemberType NoteProperty
$vMotionDetails | Add-Member -name "vMOTION IP Address" -Value $vmnic.IP -MemberType NoteProperty
$vMotionDetails | Add-Member -name "VLAN" -Value (Get-VirtualPortGroup -VMHost $VMHost.name -Name $vmnic.PortGroupName).VLANID -MemberType NoteProperty
$vMotionDetails | Add-Member -name "Subnet Mask" -Value $vmnic.SubnetMask -MemberType NoteProperty

$vMotionAudit += $vMotionDetails
}

}

Write-Output $vMotionAudit

}
Share

You may also like...

Leave a Reply

Your email address will not be published.