This is a PowerCLI script to list VMware ESXi host that has IPv6 disabled in you vCenter.
This problem is that disabling IPv6 in newer versions of ESXi can sometimes result in PSOD, so even if you are not using IPv6 in your environment, you should keep it enabled. https://kb.vmware.com/s/article/2150794
Import-Module VMware.PowerCLI
Connect-VIServer <Insert vCenter server FQDN>
$VMHosts = Get-VMHost | Sort-Object
foreach ($VMHost in $VMHosts) {
if ($VMHost.ConnectionState -ne "Connected" ) {
$status = "Unknown. Host Status: $($VMHost.Connectionstate)"
Write-host("$($VMHost): $($status)")
} else {
$value = ($VMHost | Get-VMHostModule tcpip4).Options
if ($value -match "ipv6=1") {
$status = "Enabled"
#Write-host("$($VMHost): $($status)")
} elseif ($value -match "ipv6=0") {
$status = 'Disabled'
Write-host("$($VMHost): $($status)")
} else {
$status = "Unknown"
Write-host("$($VMHost): $($status) - $($value)")
}
}
}
Hope this helps you. Keep in mind that use of this script is entirely your responsibility, and you should always understand what a script does before you run it.
To enable IPv6 on hosts using PowerCLI check this post: https://vm.knutsson.it/?p=1198
One thought on “Check if IPv6 is disabled”