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 ?
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 !
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
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
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.
Excellent guys ! Thanks so much !
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.GetMemberCommandI assume that it is looking for an object in $_ which is empty
Thanks
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
Thought so - working fine now.... Thanks LucD !