Getting VMware Host Physical Nic Speeds

I had an issue with one of my hosts this week who's nic had auto-negotiated to the wrong speed, following this I wrote a quick script to check the rest of my hosts.

Good job as there were a fair few nics running at 100MB rather than 1GB causing a few issues.

The following script will list each host and there nics and speeds....

Connect-VIServer MYVISERVER

$VMhosts = Get-VMHost | Get-View
Foreach ($vmhost in $vmhosts)
{
Write-Output $vmhost.Name
$pnic = 0
Do
{
$Speed = $VMhost.Config.Network.Pnic[$pnic].LinkSpeed.SpeedMb
Write "Pnic$pnic $Speed"
$pnic ++
}
Until ($pnic -eq ($VMhost.Config.Network.Pnic.Length))
}