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

Howdy-

 

Good, glad to hear it.  And, no, I would not mind at all.  That @{n="vCenter"...} piece is a "calculated property".  A calculated property consists of key/value pairs.  In the calculated property in this example, the value of the "n" key specifies the name of the calculated property ("vCenter"), and the value of the "e" key specifies the script block Expression to use to determine the value for the "vCenter" property in the output.

 

As for what is happening in the script block for the expression in the calculated property:

The scriptblock:  ($_.ExtensionData.Client.ServiceUrl -replace "http[s]?://", "").Split("/")[0]

 

At this point, an example value of $_.ExtensionData.Client.ServiceUrl would be "https://myvcenter.domain.com/sdk".  I'll refer to this as the "valueString".

 

This does a few things:

  1. replaces "http://" and "https://" with nothing (the "[s]?" in the "http[s]?://" signifies that the "s" is optional)
    at this point, valueString is "myvcenter.domain.com/sdk"
  2. then splits valueString on the "/" character
    this results in an array of strings:  "myvcenter.domain.com" and "sdk"
  3. then the expression accesses the first item in the array (at index 0)
    this results in returning the value "myvcenter.domain.com"

 

That help?


Viewing all articles
Browse latest Browse all 228309

Trending Articles



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