VMware {code} Community
MichalHerman
Contributor
Contributor

Get host hardware property

Hi,

I want in my Java program to retrieve virtual machine host hardware properties. I am invoking retrievePropertiesEx to get properties values.

When I want to get runtime.host property I get ManagedObjectReference so it works OK.

But when I try to get runtime.host.hardware property I get a Java RuntimeException.

Any ideas why? What I am doing wrong?

0 Kudos
1 Reply
Treecko
Contributor
Contributor

In the vSphere Management SDK, they have some sample scripts that you can run to grab hardware info from your host PCs - specifically the GetHostName.java example. Download the SDK​ (make sure you download the right version), and take a look at vsphere-ws/java/JAXWS/samples/com/vmware/general/GetHostName.java to see how they retrieve info from managed objects. The managed object you should be reading from is the HostSystem object; just double check that the properties you're trying access exist. I don't know off the top of my head how this object is laid out, but you can take a look at the reference docs.

0 Kudos