Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 228309

Re: Listing the virtual center for a given host

$
0
0

Greetings-

 

I see.  Looks like that property on the VMHostImpl object (returned from Get-VMHost) has not always been there.  I was checking against an environment that has the vSphere 5.1 API.  I saw, like you pointed out, that these other properties were not present when testing against a v5.0 API environment.

 

So, yes, like you said -- the ".Client.ServiceUrl" property of the View object for the host has a string that can be used to deduce the vCenter server name.  And, you can still access that property from the VMHostImpl object via the .ExtensionData property.  Something like:

 

Get-VMHost | select Name,
    @{n
="vCenter"; e={($_.ExtensionData.Client.ServiceUrl -replace"http[s]?://", "").Split("/")[0]}}

 

That do it?


Viewing all articles
Browse latest Browse all 228309

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>