VMware Cloud Community
Hiront
Enthusiast
Enthusiast

Monitoring Horizon License Usage through View API

Hi expert

I would like to get Horizon License usage using PowerCLI

Could you tell me how to get license usage using command ?

THX

0 Kudos
1 Reply
sjesse
Leadership
Leadership

If you have a concurrent license you can get the number of sessions running this way, just set $hzConn to the connection server, $hzUser to a user that con logon to the connection server, $hzPass to $hzUsers password, and $hzDomain to the domain that $hzUser is in. I got this from Horizon View API - The SLOG – SimonLong/Blog

# Import the Horizon module

Import-Module VMware.VimAutomation.HorizonView

# Establish connection to Connection Server

$hvServer = Connect-HVServer -server $hzConn -User $hzUser -Password $hzPass -Domain $hzDomain

$ViewAPI = $hvServer.ExtensionData

$query_service = New-Object "Vmware.Hv.QueryServiceService"

$query = New-Object "Vmware.Hv.QueryDefinition"

$query.queryEntityType = 'SessionLocalSummaryView'

$Sessions = $query_service.QueryService_Query($ViewAPI,$query)

$Sessions.Results.NamesData | Select-Object -Property UserName,DesktopType,DesktopName,MachineOrRDSServerDNS

Named users would be harder since you need to count the users. The API has a license function, but its just the features enabled in the license not the usuage.