VMware {code} Community
mickmason
Contributor
Contributor
Jump to solution

Accessing custom field through SDK

Hi,

Our VMWare administrators have added a custom field that shows up as a column when viewingthe Virtual Machines tab.

Are there any methods in the SDK that would allow me access this custom field? I'm using C#, but I could probably use a Perl example as a starting point.

Thanks

Mick

0 Kudos
1 Solution

Accepted Solutions
lamw
Community Manager
Community Manager
Jump to solution

Take a look at these two scripts for sample code:

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

If you find this information useful, please award points for "correct" or "helpful".

View solution in original post

0 Kudos
3 Replies
mickmason
Contributor
Contributor
Jump to solution

I omitted to mention that the tab shows up in the Virtual Infrastructure Client.

M

0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

Take a look at these two scripts for sample code:

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
mickmason
Contributor
Contributor
Jump to solution

Thanks.

That sent me in the right direction.

In C# it looks something like this (we only have one custom field, so I haven't had to iterate through the collection).

machine is my own object that stores info about the guest, VM is an instance of VirtualMachine.

CustomFieldValue[] cfv = vm.Summary.CustomValue;

CustomFieldStringValue euc = (CustomFieldStringValue)cfv[0];

machine.Euc = euc.Value.ToString(); ;

0 Kudos