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);
}