The VDS Health check results are not really documented.
I looked at this in the past, and I think I have been able to calculate all of them, except for the VLAN Health Status.
This is what I have so far
Get-VDSwitch -PipelineVariable vds |
ForEach-Object -Process {
$vds.ExtensionData.Runtime.HostMemberRuntime |
ForEach-Object -Process {
$esx = Get-View -Id $_.Host -Property Name,'Runtime.ConnectionState'
New-Object -TypeName PSObject -Property @{
VDS = $vds.Name
HostName = $esx.Name
State = $esx.Runtime.ConnectionState
VDSStatus = $_.Status
Teaming = if($_.HealthCheckResult.TeamingStatus -notmatch 'Mismatch'){'Normal'}else{'Warning'}
MTU = if($_.HealthCheckResult.Where({$_ -is [VMware.Vim.VMwareDVSMtuHealthCheckResult]}).MtuMisMatch -notcontains $true){'Normal'}else{'Warning'}
VLAN = '?'
}
}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
this is very close to what we need, we just need the VLAN results - were you ever able to find those?
Thanks for posting up what you have!
The last version I have includes the VLAN,MTU and Teaming health check status.
But use at your own risk!
I'm not 100% sure the script interprets the results correctly in all situations.
Get-VDSwitch -PipelineVariable vds |
ForEach-Object -Process {
$vds.ExtensionData.Runtime.HostMemberRuntime |
ForEach-Object -Process {
$esx = Get-View -Id $_.Host -Property Name, 'Runtime.ConnectionState'
$obj = New-Object -TypeName PSObject -Property ([ordered]@{
VDS = $vds.Name
HostName = $esx.Name
State = $esx.Runtime.ConnectionState
VDSStatus = $_.Status
VLANandMTUHealth = 'Disabled'
TeamingHealth = 'Disabled'
Teaming = ''
MTU = '? unknown'
VLAN = '? unknown'
})
if($vds.ExtensionData.Config.HealthCheckConfig[0].Enable) {
$obj.VLANandMTUHealth = 'Enabled'
$obj.VLAN = if ($_.HealthCheckResult.Where({ $_ -is [VMware.Vim.VMwareDVSVlanHealthCheckResult] }).UntrunkedVlan -eq $null) { 'Normal' }else { 'Warning' }
}
if ($vds.ExtensionData.Config.HealthCheckConfig[1].Enable) {
$obj.TeamingHealth = 'Enabled'
$obj.Teaming = &{
$teaming = $_.HealthCheckResult.Where({ $_ -is [VMware.Vim.VMwareDVSTeamingHealthCheckResult] })
if($teaming){
if ($teaming.TeamingStatus -match 'Mismatch'){'Warning'}else{'Normal'}
}
else{'? unknown'}
}
$obj.MTU = &{
$mtu = $_.HealthCheckResult.Where({ $_ -is [VMware.Vim.VMwareDVSMtuHealthCheckResult] })
if ($mtu.VlanNotSupportSwitchMtu -ne $null){'Warning'}else{'Normal'}
}
}
$obj
}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference