Monday, March 26, 2018

Horizon view | Powercli command to get the number of VM's in all pool

This  is a Horizon view  Powercli command to get the number of VM's in all available pool with status connected/disconnected.


Get-Pool | %{
   $remote = Get-RemoteSession -Pool_id $_.Pool_id
   $_ | Select @{N="Name";E={$_.Pool_id}},
     @{N="VM in pool";E={Get-DesktopVM -Pool_id $_.Pool_id | Measure-Object | Select -ExpandProperty Count}},
     @{N="Connected";E={$remote | where {$_.State -eq "CONNECTED"} | Measure-Object | Select -ExpandProperty Count}},
     @{N="Disconnected";E={$remote | where {$_.State -eq "DISCONNECTED"} | Measure-Object | Select -ExpandProperty Count}}
 }



Regards
Bijesh

No comments:

Post a Comment