How can I retrieve vCenter's instance name with SDK?
In vsphere Client i can see the name (in image below : SRVCENTER):
I could not find it in any object...
Thanks in advance
Thank you very much, but i still have a problem.
This is my code:
ServiceInstance si = new ServiceInstance(url, username, password, ignoreCert); OptionManager om = si.getOptionManager(); OptionValue ovs =om.queryOptions("VirtualCenter.InstanceName");
It returns this error on the third line:
Exception in thread "main" com.vmware.vim25.NoPermission
Also, this instruction:
OptionValue ovs =om.getSetting();
returns a NullPointerException...
Where is the problem?
You'll need to login. If you are logging in, you also need permissions:
This method might require any of the following privileges depending on where the property fits in the inventory tree.
- System.View on the root folder, if this is used to read settings in the "client" subtree.
- System.Read on the root folder, if this is used to read all settings or any settings beside those in the "client" subtree.
- System.Read on the host, if this is used to read the advanced options for a host configuration.