Now that works perfectly! Many thanks.
Still trying to wrap my head around the use of $_.resourcepool.
This is going to be blank if the VM is on a standalone host and populated if the VM is in a cluster, regardless of the use of resource pools in the cluster?