1 Reply Latest reply on Jun 27, 2019 4:50 PM by lurims

    Getting all ESXi host systems of vCenter using Server.findAllForType

    lurims Enthusiast

      Trying to make a query that build all ESXi hosts of a vCenter using Server.findAllForType.  Tried this code but did not work.  Could anyone help?

       

      var vc = myvCenter.abc.com;

      var allESXihosts = Server.findAllForType("VC:HostSystem", "vimHost.id eq '" + vc + "'");

      System.log(allESXihosts.length);

      for each(var host in allESXihosts){

           System.log(host.name + ',' + host.vimHost.id);

      }