- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Retrieve vCenter instance name
Hi,
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
Henry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You'll want the OptionManager object on the ServiceInstance.
ServiceInstance -> setting ['VirtualCenter.InstanceName']
Reuben Stump | http://www.virtuin.com | @ReubenStump
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Reuben Stump | http://www.virtuin.com | @ReubenStump