Quantcast
Channel: VMware Communities: Message List - How to get currently-connected server?
Viewing all articles
Browse latest Browse all 8

Re: How to get currently-connected server?

0
0

I've used it for years.  It's used internally by other methods, so I think it's pretty safe.  If I recall correctly, it's just getting the service_url property after it's constructed.  So you want to us it after the Vim object is instantiated with a server or url property.

 

Alternatively, you could query the ServiceContent information from the API directly.  It should contain the hostname of the vCenter server.  Of course this won't tell you if the script used IP address or hostname.  I also ran into some bugs with session id values and short hostnames (myvcenter vs myvcenter.domain.local for example).  I just worked around it in my custom code by using a hostname to ip conversion before doing a load_session().

 

I haven't confirmed if this is still an issue with 5.x, but it was an issue with 4.x.


Viewing all articles
Browse latest Browse all 8

Latest Images

Trending Articles





Latest Images