Jump to content
Welcome to our new Citrix community!
  • 0

PowerShell get vms hosted on a particular pool member


Question

Hi,

 

is there a way in Powershell SDK to find VMs belonging to a particular pool member? (the affinity to a homeserver)

 

#this returns all VMs from the whole pool:

$vms = get-xenvm | Where-Object {$_.is_a_template -ne "False" -and $_.is_control_domain -ne "False"}

 

How do I return the name of the xenserver pool member the VM actually belongs to... or just filter the list by a pool member name? 

 

Any help is very much appreciated.

 

Stefan

Link to comment

2 answers to this question

Recommended Posts

  • 0

A simpler way to write the above is

Get-XenHost -Name "hostname" | select -Expandproperty resident_VMs | Get-XenVM

 

However, you mentioned affinity to a home server. This is not the same as the server where the VM runs. Affinity is the server where we prefer the VM to run, but if there are no available resources, it may run on a different server. The above snippet returns the VMs currently running on a given server, but it doesn't mean that all these VMs have this server affinity or any affinity at all.

 

To query VMs with a certain server affinity:

Get-XenVM | where {$_.affinity -eq $h.opaque_ref}

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...