VMware {code} Community
SDK201110141
Contributor
Contributor

Getting CustomizationSpecItem from VSphere with C#

Hi,

I'm trying to get all the CustomizationSpecItem from VMware with C# but I'm getting an error.

The error is in the FindEntityViews() method.

Error:

ViewType is not ManagedEntity

My code:

public static List<CustomizationSpecItem> GetAllGuestCustoms()
        {
            VimClient vimClient = new VimClient();

            vimClient = VMWareServerConnection.ConnectToVMServer();

            IList<CustomizationSpecItem> iListCSI =                                                                 (IList<CustomizationSpecItem>)vimClient.FindEntityViews(typeof(CustomizationSpecItem), null, null, null);

            List<CustomizationSpecItem > listCSI = new List<CustomizationSpecItem>();

            foreach (CustomizationSpecItem CSI in iListCSI)
            {
                listCSI.Add(CSI);
            }

            vimClient.Disconnect();

            return listCSI;
        }

Can someone help me here please?

What i need is to get the Client Windows Guest Customizations that i specified in the VMWare Server, so i can apply them to new VMs.

0 Kudos
0 Replies