VMware {code} Community
Partridge
Contributor
Contributor
Jump to solution

Retrieve HostSystem

Hi,

I'm trying to retrieve a the HostSystem for my ESX server so that I can work my way down and rescan my HBAs. I've tried to get it by using FindByIp and FindByDnsName, but with no luck. The hostd log shows the input IP or DNS is compared only against the VMs, not itself.

Is there a way to get the HostSystem for the ESX server? I'd like to be able to retrieve whether I'm connecting to an ESX or VC.

Thanks.

0 Kudos
1 Solution

Accepted Solutions
admin
Immortal
Immortal
Jump to solution

For findByIP method, you will need to the pass atleast three parameters:

a) the managedobjectreference of a searchindex which is a property of servicecontent

b) the ip address of the host

c) vmSearch boolean needs to be passed as false, for searching hosts.

I think you are probably missing on the vmSearch - false parameter. When a true boolean is passed, then only vms are looked for.

View solution in original post

0 Kudos
2 Replies
admin
Immortal
Immortal
Jump to solution

For findByIP method, you will need to the pass atleast three parameters:

a) the managedobjectreference of a searchindex which is a property of servicecontent

b) the ip address of the host

c) vmSearch boolean needs to be passed as false, for searching hosts.

I think you are probably missing on the vmSearch - false parameter. When a true boolean is passed, then only vms are looked for.

0 Kudos
Partridge
Contributor
Contributor
Jump to solution

That flag is what I forgot. I was using FindByIp elsewhere and it was already setup for VMs and I totally forgot about that flag. Thank you.

0 Kudos