2 Replies Latest reply on Sep 29, 2018 6:34 AM by aenagy

    How to find management IP(s) of ESXi host from VcHostSystem (vRO 7.3 and vSphere 6.0)

    aenagy Hot Shot

      I am trying to find the ESXi host to which a virtual machine is registered. From the vm I am able to find the host (VcHostSystem) in vRO. Searching the API it would appear that I need HostVirtualNicManagerNicType (vSphere 6.0 Documentation Center). The code below allows me to iterate over the virtual NICs and includes IP address information but I haven't figured out how to definitively determine which interface(s), and therefore which IP(s), are designated for ESXi management.


      var          EsxiHostConfigNetworkdVnic = vm.runtime.host.config.network.vnic
      System.log( "EsxiHostConfigNetworkdVnic.length = " + EsxiHostConfigNetworkdVnic.length )
      for( var VnicIndex = 0 , VnicLength = EsxiHostConfigNetworkdVnic.length ; VnicIndex < VnicLength ; VnicIndex++ ){
      System.log( "EsxiHostConfigNetworkdVnic[" + VnicIndex + "] = " + EsxiHostConfigNetworkdVnic[ VnicIndex ] )


      Thanks in advance.


      P.S. I hope I got the correct forum.