How to find out number of available Virtual Functions on a Mellanox Card in vCenter Server 8

Today I faced a problem in vSphere where I cannot find the number of used and available Virtual Function on a Mellanox Card.As you see here you can define the maximum number of Virtual Function on a Mellanox card but the detail is not shown in vCenter Server.

With following Powershell command you will be able to find out how many virtual function will be available per vmnic

$esxiHosts = Get-VMHost
foreach ($esxiHost in $esxiHosts) {
$netadapters= Get-VMHostNetworkAdapter -VMHost $esxiHost
foreach ($netadapter in $netadapters) {
$esxcli = Get-EsxCli -VMHost $esxiHost
try {
$totalSriov = ($esxcli.network.sriovnic.vf.list($netadapter.name) | where { $_.active -eq $false}).length
if ($?) {
$esxcli.network.sriovnic.vf.list($netadapter.name)
Write-host “the SRIOV is enabled on ” $netadapter.Name ” on the host “$esxiHost “and number of available Virtual function is “$totalSriov
$esxcli.network.sriovnic.vf.list($netadapter.name)

#$output += $totalSriov
}
else{ Write-host “the SRIOV is NOT enabled on ” $netadapter.Name
}

}catch {}

}
}

And the ouput would be like:

Leave a Reply

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

− 4 = 1