VMware Cloud Community
jt30605
Contributor
Contributor
Jump to solution

Get-VirtualSwitch - NumPortsAvailable Question

When i run the get-virtualswitch cmdlet, the output for NumPortsAvailable is completely wrong. Am I missing something?

Example:

One of my hosts returns this for vSwitch1

Name : vSwitch1

NumPorts : 64

NumPortsAvailable : 61

I know the NumPorts is 64 instead of 56 due to the 8 reserved, but the NumPortsAvailable shows that I'm only using 3 ports on this vSwitch. In fact, there are 46 ports being used on this vSwitch.

Anyone have any idea why the NumPortsAvailable value is so off?

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Can you give the following script a go and check if it changes anything ?

$esxName = <ESX-hostname>
$esx = Get-VMHost $esxName | Get-View

$netSys = Get-View $esx.ConfigManager.NetworkSystem
$netSys.RefreshNetworkSystem()
$esx.UpdateViewData()

$esx.Config.Network.Vswitch | %{
	Write-Host "vSwitch" $_.Name "Port#" $_.NumPorts "Available" $_.NumPortsAvailable
}

This script is similar to using the panel in the vSphere client.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
7 Replies
LucD
Leadership
Leadership
Jump to solution

We seem to have had a similar report some months ago, see Get-VirtualSwitch available ports wierdness.

But there was no solution, the problem apparently went away after some time.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

jt30605
Contributor
Contributor
Jump to solution

Well that sucks. I wanted to use it as part of a daily report, guess I'll leave that info out.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Did you try the advises from the other post ?

Does esxcfg-vswitch -l also return wrong numbers ?

And what does the vCenter client show ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

jt30605
Contributor
Contributor
Jump to solution

Running esxcfg-vswitch -l returns the correct values. I ran the code snipet from the other post and got the same incorrect numbers. The networking tab in the vCenter client looks fine.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Can you give the following script a go and check if it changes anything ?

$esxName = <ESX-hostname>
$esx = Get-VMHost $esxName | Get-View

$netSys = Get-View $esx.ConfigManager.NetworkSystem
$netSys.RefreshNetworkSystem()
$esx.UpdateViewData()

$esx.Config.Network.Vswitch | %{
	Write-Host "vSwitch" $_.Name "Port#" $_.NumPorts "Available" $_.NumPortsAvailable
}

This script is similar to using the panel in the vSphere client.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
jt30605
Contributor
Contributor
Jump to solution

I ran this today and got the same incorrect values. It then occured to me that I had not updated PowerCLI since updating my host to U1. I updated the PowerCLI and the issue is now fixed. Guess I should have thought of that first. Thanks for all of your help with this LucD.

0 Kudos
timparkinsonShe
Enthusiast
Enthusiast
Jump to solution

I was the person who posted the other thread. Actually the problem went away and then came back again. I just gave up on it. Maybe I'll try an updated PowerCLI on the machine that was generating the report I was trying to run.

0 Kudos