VMware Cloud Community
GregRoberts2011
Enthusiast
Enthusiast

PowerCLI - Getting Custom Attributes

Hi

I am struggling to find out how to read custom attributes for a few reasons :

- i am a powerCLI newbie

- Google articles vary on the syntax, mechanism

- I can't be sure how "standard" our setup is - below is the poweshell object and a view from vSphere

I am interested in the "owner" and "Notes"

>> After some hints on how to access these fields ?

Thanks in advance

ESX_Custom_Info.png

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership

You can use the Get-Annotation or Get-CustomAttribute cmdlets to retrieve these properties.

Have a look at the examples on the reference pages.


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

twsteffen
Contributor
Contributor



If you want to use your object you could do something like this: 


$VMobj = Get-VM YourVMName


$VMobj.CustomFields.Keys[6]


$VMobj.CustomFields.Values[6]


$VMobj.Notes


 


$VMobj.CustomFields.Keys


ThisAttribute