Automation

 View Only
  • 1.  get-vms from cluster A, Cluster B and cluster C ( Resource Pool 1)

    Posted May 22, 2014 12:09 AM

    how do I get the output of vms from cluster A, cluster B and cluster C (only from resource pool1)?

    Thanks



  • 2.  RE: get-vms from cluster A, Cluster B and cluster C ( Resource Pool 1)

    Posted May 22, 2014 05:18 AM

    Do you mean something like this ?

    Get-VM -Location (Get-ResourcePool -Name "Resource Pool 1" -Location (Get-Cluster -Name "Cluster A","Cluster B","Cluster C")) | Select Name

    Or in a more "readable" version

    $rpName = "Resource Pool 1"

    $clusterName = "Cluster A","Cluster B","Cluster C"

    $cluster = Get-Cluster -Name $clusterName

    $rp = Get-ResourcePool -Name $rpName -Location $cluster

    Get-VM -Location $rp | Select Name



  • 3.  RE: get-vms from cluster A, Cluster B and cluster C ( Resource Pool 1)

    Posted May 23, 2014 08:43 PM

    Luc

    This only gave me the vms in the Resource Pool 1,  rp.

    I was not able to get the vms from the other 2 clusters.

    any idea?

    thanks



  • 4.  RE: get-vms from cluster A, Cluster B and cluster C ( Resource Pool 1)

    Posted May 23, 2014 08:46 PM

    looks like I was able to do it like this but awkward

    get-vm -location (get-cluster -name "CL1", "CL2") ; get-vm -location (get-resourcepool -name "RP")



  • 5.  RE: get-vms from cluster A, Cluster B and cluster C ( Resource Pool 1)

    Posted May 23, 2014 08:52 PM

    You will get all the VMs from clusters CL1 and CL2 and all the VMs from any resourcepool called RP.



  • 6.  RE: get-vms from cluster A, Cluster B and cluster C ( Resource Pool 1)

    Posted May 23, 2014 09:36 PM

    I tried both and gave same results. only the vms in the RP is showing.

    I think the problem is that the RP is only location on CL1

    the other 2 clusters have none of this RP.



  • 7.  RE: get-vms from cluster A, Cluster B and cluster C ( Resource Pool 1)

    Posted May 23, 2014 10:42 PM

    Just to clarify, what exactly do you want ?

    All the VMs in resourcepool1, that is present on cluster A, B and C ?

    Or all the VMs in cluster A and B, and the VMs in resourcepool1 on cluster C ?



  • 8.  RE: get-vms from cluster A, Cluster B and cluster C ( Resource Pool 1)

    Posted May 23, 2014 08:48 PM

    Strange, the Location parameter accepts an array of VIContainer objects.

    Which script did you use ? The 1st one or the 2nd one ?

    Try the 2nd one and check if the intermediate steps give the expected results.

    You could do that by displaying the variables $cluster and $rp on screen