Automation

 View Only
Expand all | Collapse all

Get-VMHostNetworkAdapter not working on some hosts

  • 1.  Get-VMHostNetworkAdapter not working on some hosts

    Posted Aug 03, 2017 07:31 AM

    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



  • 2.  RE: Get-VMHostNetworkAdapter not working on some hosts

    Posted Aug 03, 2017 07:36 AM

    Which PowerCLI version are you using?

    Do a Get-PowerCLIVersion.



  • 3.  RE: Get-VMHostNetworkAdapter not working on some hosts

    Posted Aug 03, 2017 08:44 AM

    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



  • 4.  RE: Get-VMHostNetworkAdapter not working on some hosts

    Posted Aug 03, 2017 11:25 AM

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

    I remember seeing a similar issue with older PowerCLI releases.



  • 5.  RE: Get-VMHostNetworkAdapter not working on some hosts

    Posted Aug 03, 2017 11:30 AM

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

    any recommended version that won't break my scripts :smileyhappy: ??



  • 6.  RE: Get-VMHostNetworkAdapter not working on some hosts

    Posted Aug 03, 2017 11:34 AM

    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.



  • 7.  RE: Get-VMHostNetworkAdapter not working on some hosts

    Posted Nov 29, 2017 11:37 AM

    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. 



  • 8.  RE: Get-VMHostNetworkAdapter not working on some hosts

    Posted Jul 30, 2020 01:29 PM

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



  • 9.  RE: Get-VMHostNetworkAdapter not working on some hosts

    Posted Jul 30, 2020 01:34 PM

    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.



  • 10.  RE: Get-VMHostNetworkAdapter not working on some hosts

    Posted Jul 30, 2020 01:39 PM

    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.



  • 11.  RE: Get-VMHostNetworkAdapter not working on some hosts

    Posted Jul 30, 2020 01:41 PM

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



  • 12.  RE: Get-VMHostNetworkAdapter not working on some hosts

    Posted Jul 30, 2020 02:44 PM



  • 13.  RE: Get-VMHostNetworkAdapter not working on some hosts

    Posted Jul 30, 2020 02:49 PM

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



  • 14.  RE: Get-VMHostNetworkAdapter not working on some hosts

    Posted Jul 30, 2020 02:52 PM

    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.



  • 15.  RE: Get-VMHostNetworkAdapter not working on some hosts

    Posted Jul 30, 2020 02:53 PM

    Correct, this is an internal error.

    Nothing to do with a missing parameter afaik.