VMware Cloud Community
pargit
Enthusiast
Enthusiast

Get-VMHostNetworkAdapter not working on some hosts

hi,

i have a script that use the Get-VMHostNetworkAdapter cmdlet.

it runs on several esxi server (5.5u3) but other fail with the following error:

Get-VMHostNetworkAdapter : 03/08/2017 09:53:25Get-VMHostNetworkAdapterValue cannot be null.
Parameter name: key

At line:4 char:76

+ ... .xxx.internal" | Get-VMHostNetworkAdapter | Where ...

+                                          ~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Get-VMHostNetworkAdapter], VimException

    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.Host.GetVMHostNetworkAdapter

i can't figure out what is the difference between the hosts (as they installed from the same iso, use the same profile etc..)

Example:

PS M:\> Get-VMHost "pru-esx01.xxx.internal" | Get-VMHostNetworkAdapter

Name       Mac               DhcpEnabled IP              SubnetMask      DeviceName

----       ---               ----------- --              ----------      ----------

vmnic0     00:25:xx:xx:00:00 False                                           vmnic0

vmnic1     00:25:xx:xx:00:00 False                                           vmnic1

vmnic10    00:25:xx:xx:00:05 False                                          vmnic10

vmnic11    00:25:xx:xx:00:05 False                                          vmnic11

vmnic2     00:25:xx:xx:00:01 False                                           vmnic2

vmnic3     00:25:xx:xx:00:01 False                                           vmnic3

vmnic4     00:25:xx:xx:00:02 False                                           vmnic4

vmnic5     00:25:xx:xx:00:02 False                                           vmnic5

vmnic6     00:25:xx:xx:00:03 False                                           vmnic6

vmnic7     00:25:xx:xx:00:03 False                                           vmnic7

vmnic8     00:25:xx:xx:00:04 False                                           vmnic8

vmnic9     00:25:xx:xx:00:04 False                                           vmnic9

vmk0       00:25:xx:xx:00:00 False       10.xxx.xxx.40   255.255.255.0         vmk0

vmk1       00:50:xx:xx:63:22 False       30.30.30.1      255.255.255.0         vmk1

vmk4       00:50:xx:xx:b2:d7 False       10.xxx.xxx.1    255.255.255.224       vmk4

vmk3       00:50:xx:xx:c5:cf False                                             vmk3

PS M:\> Get-VMHost "pru-esx05.xxx.internal" | Get-VMHostNetworkAdapter

Get-VMHostNetworkAdapter : 03/08/2017 10:28:30 Get-VMHostNetworkAdapter Value cannot be null.

Parameter name: key

At line:1 char:63

+ ... sx05.oob.ramportal.eng.pelephone.internal" | Get-VMHostNetworkAdapter

+                                                  ~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Get-VMHostNetworkAdapter], VimException

    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.Host.GetVMHostNetworkAdapter

any help will be appreciated.

thanks

mordechai

14 Replies
LucD
Leadership
Leadership

Which PowerCLI version are you using?

Do a Get-PowerCLIVersion.


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

Reply
0 Kudos
pargit
Enthusiast
Enthusiast

PS M:\> Get-PowerCLIVersion

PowerCLI Version

----------------

   VMware vSphere PowerCLI 5.5 Release 2 Patch 1 build 1931983

---------------

Snapin Versions

---------------

   VMWare AutoDeploy PowerCLI Component 5.5 build 1890764

   VMWare ImageBuilder PowerCLI Component 5.5 build 1890764

   VMware License PowerCLI Component 5.5 build 1265954

   VMware VDS PowerCLI Component 5.5 build 1926677

   VMware vSphere PowerCLI Component 5.5 Patch 1 build 1926677

Reply
0 Kudos
LucD
Leadership
Leadership

Is it possible to upgrade to a newer supported PowerCLI version?

I remember seeing a similar issue with older PowerCLI releases.

vc55u3.png


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

Reply
0 Kudos
pargit
Enthusiast
Enthusiast

i can try. i hope i'll get to this today..

any recommended version that won't break my scripts Smiley Happy ??

Reply
0 Kudos
LucD
Leadership
Leadership

It looks like PowerCLI 6.5.0 supports both vCenter 5.5U3 and ESXi 5.5U3.

Not 100% sure what is in your script exactly, but normally there shouldn't be any issues.


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

Reply
0 Kudos
IB_IT
Expert
Expert

Did you ever get this fixed?  Having same problem when using the get-vmhostadapter cmdlet.  "Value cannot be null".  I have two vcenters...works fine connected to one vcenter...doesn't work connected to another.  I've tried powercli 5.8 versions, 6.0 release 1 and 6.5 release 1.  Both have exact same vcenter and host build versions. 

Reply
0 Kudos
DanMan3395
Enthusiast
Enthusiast

We are seeing this issue in an 7.0 vcenter with PCLI 12. is there anything new about how to address it?

Reply
0 Kudos
LucD
Leadership
Leadership

Are you getting that error consistently for the same ESXi nodes?

For all ESXi nodes?
Also after a stop/start of your PS session?

When running on different stations?

I did see some recent reports of that error, but they were most of the time intermittent, and on a specific station/PowerCLI installation.


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

DanMan3395
Enthusiast
Enthusiast

all nodes, have tried multiple sessions from multiple connection points. Posh 7.03 with pcli 12. The only thing significantly different with the vcenters that produce this error and the old legacy ones that don't is that these are version 7, old are 6.5 and 6.7 and that the new 7.0 stuff has nsx on it.

Reply
0 Kudos
LucD
Leadership
Leadership

Out of curiosity, do you still have a PS v5.1 station from where you could run the same?


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

Reply
0 Kudos
DanMan3395
Enthusiast
Enthusiast

pastedImage_0.jpg

Reply
0 Kudos
LucD
Leadership
Leadership

I'm afraid that I can only suggest to open an SR


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

DanMan3395
Enthusiast
Enthusiast

you are the grand master of pcli so i figure you might know this. Based on the error, it looks like the "key" parameter is somewhere in the code for the commandlet though right? its not looking for a parameter from the user I assume.

Reply
0 Kudos
LucD
Leadership
Leadership

Correct, this is an internal error.

Nothing to do with a missing parameter afaik.


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