What you really want to try is something like this...
var tenant = "vsphere.local" //tenant name
var host = vCACCAFEHostManager.getDefaultHostForTenant(tenant , true);
Steve Beaver
VMware Communities User Moderator
VMware vExpert 2009 - 2020
VMware NSX vExpert - 2019 - 2020
====
Co-Author of "VMware ESX Essentials in the Virtual Data Center"
(ISBN:1420070274) from Auerbach
Come check out my blog: [www.virtualizationpractice.com/blog|http://www.virtualizationpractice.com/blog/]
Come follow me on twitter http://www.twitter.com/sbeaver
**The Cloud is a journey, not a project.**