When you create a virtual machine, you always specify the resource pool that the virtual machine can draw resources from and optionally a host on which the virtual machine should run. You can access the resource pool as follows:
- Standalone host – When you call Folder.AddStandaloneHost_Task, the call returns a Task object that contains the ComputeResource. The ComputeResource.resourcePool property is the root resource pool associated with the compute resource (and with the host).
- Cluster – When you call Folder.CreateClusterEx, the method returns a managed object reference to a ClusterComputeResource instance. Because ClusterComputeResource inherits all properties of ComputeResource, you can access the root resource pool through the ClusterComputeResource.resourcePool property.