VMware Cloud Community
Fjorko
Contributor
Contributor
Jump to solution

$_.Extensiondata Help Please

Hi All

I understand that the above will dig deeper in getting more info from a Vsphere object point of view. What I do not understand is how do you get to all the properties/methods or whatever you wanna call it, for example, how do you know all the options available to you from the Extensiondata object, is there some sort of "Get-Member" to see all the properties and methods you can string together ?

$_.Extensiondata.Summary.Config.Product.Build
$_.Extensiondata.Summary.Hardware.CpuMode
$_.Extensiondata.Config.Product.Name

So looking at the above, how do I find ALL the bits i can tag on the back of Extensiondata like the bold items as shown

Many thanks - and apologies if it does not make sense at all. 🙂

Cheers !

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You should of course have something in $_

Get-VMHost MyEsx | %{$_.ExtensionData | gm}

The $_ variable represents the object that was passed through the pipeline.

In the example above the VMHostImpl object.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
6 Replies
admin
Immortal
Immortal
Jump to solution

Hi,

You can use Get-Member to see both the properties and methods:

$_.ExtensionData | Get-Member

$_.ExtensionData.Summary | Get-Member

You can aso use the VIM API reference - just check the type of extension data and look it up in the reference:

$_.ExtensionData.GetType().Name

http://pubs.vmware.com/vsphere-50/index.jsp?topic=/com.vmware.wssdk.apiref.doc_50/right-pane.html

Regards,

Dimitar

RvdNieuwendijk
Leadership
Leadership
Jump to solution

Besides the Get-Member cmdlet and the SDK documentation there is also another cmdlet you can use: Format-Custom. This cmdlet will not only give you the property names, but it will give you the property values as well. E.g.

$_.ExtensionData | Format-Custom -Depth 1


If you increase the depth level, you will get more levels at once. But the cmdlet also takes longer to complete.

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
0 Kudos
Fjorko
Contributor
Contributor
Jump to solution

Excellent guys ! Thanks so much !

0 Kudos
Fjorko
Contributor
Contributor
Jump to solution

Oops - spoke too soon - maybe I'm just doing something wrong :

If I type $_.Extensiondata | Get-Member

I get  :

Get-Member : No object has been specified to the get-member cmdlet.
At line:1 char:30
+ $_.ExtensionData | Get-Member <<<<
    + CategoryInfo          : CloseError: (:) [Get-Member], InvalidOperationException
    + FullyQualifiedErrorId : NoObjectInGetMember,Microsoft.PowerShell.Commands.GetMemberCommand

I assume that it is looking for an object in $_  which is empty

Thanks

0 Kudos
LucD
Leadership
Leadership
Jump to solution

You should of course have something in $_

Get-VMHost MyEsx | %{$_.ExtensionData | gm}

The $_ variable represents the object that was passed through the pipeline.

In the example above the VMHostImpl object.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Fjorko
Contributor
Contributor
Jump to solution

Thought so - working fine now.... Thanks LucD !

0 Kudos