Horizon View API

VMware recently added an Horizon View API as part of the PowerCLi 6.5 R1 release, which allows customers to interact with Horizon without the need for using the User Interface (UI). Amazing as this new Horizon API is, it’s not as easy as the usual PowerCLi CmdLets we are used to using and I’ve personally found information/settings difficult to find using the API. I’ve decided to share with my readers, some of the common API’s that will give you information that you might be looking for.

I’ve decided to share with my readers, some of the common API’s that will give you information that you might be looking for.

This isn’t a ‘Getting Started’ post. If you are new to the Horizon API, then I recommend reading the following two blog posts to help get you connected.

And for a full list of Horizon API’s, check out the official Horizon View 7.0.2 API documentation.

If there are any queries that you would like me to document, let me know and I’ll get them added. You can either leave a comment below or contact me directly.

Dashboard

Quick View

Sessions-v3
1. Sessions The Sessions screen displays the information of your Connected and Disconnected Horizon sessions.

NOTE: Horizon View API - Query Service is required to capture this data. You need to use the 'SessionLocalSummaryView' QueryEntityType.
Example:
C:\> $ViewAPI = $global:DefaultHVServers[0].ExtensionData
C:\> $query_service = New-Object "Vmware.Hv.QueryServiceService"
C:\> $query = New-Object "Vmware.Hv.QueryDefinition"
C:\> $query.queryEntityType = 'SessionLocalSummaryView'
C:\> $Sessions = $query_service.QueryService_Query($ViewAPI,$query)
C:\> $Sessions.Results.NamesData | Select-Object -Property UserName,DesktopType,DesktopName,MachineOrRDSServerDNS

UserName DesktopType DesktopName MachineOrRDSServerDNS
-------- ----------- ----------- ---------------------
lab.local\longs AUTOMATED UEM-Pool uem-004.lab.local
lab.local\user1 AUTOMATED CorpIT Image v2 corpit-v2-2.lab.local

System Health

dashboard-system health-v2
1. Connection Servers This API call lists your Horizon Connection Server details.

API Call: $global:DefaultHVServers.ExtensionData.ConnectionServer.ConnectionServer_List().General
Example:
C:\> $ViewAPI = $global:DefaultHVServers.ExtensionData
C:\> $ViewAPI.ConnectionServer.ConnectionServer_List().General

Name : CON1
ServerAddress : https://con1.lab.local:443
Enabled : True
Tags :
ExternalURL : https://con1.lab.local:443
ExternalPCoIPURL : 10.0.0.1:4172
AuxillaryExternalPCoIPIPv4Address :
ExternalAppblastURL : https://con1.lab.local:8443
BypassTunnel : False
BypassPCoIPGateway : True
BypassAppBlastGateway : False
Version : 7.0.2-4356666

Name : CON2
ServerAddress : https://con2.lab.local:443
Enabled : True
Tags :
ExternalURL : https://con2.lab.local:443
ExternalPCoIPURL : 10.0.0.2:4172
AuxillaryExternalPCoIPIPv4Address :
ExternalAppblastURL : https://con2.lab.local:8443
BypassTunnel : False
BypassPCoIPGateway : True
BypassAppBlastGateway : False
Version : 7.0.2-4356666

2. Event Database This API call displays your Event Database details.

API Call:$global:DefaultHVServers.ExtensionData.EventDatabase.EventDatabase_Get().Database
Example:
C:\> $ViewAPI = $global:DefaultHVServers.ExtensionData
C:\> $ViewAPI.EventDatabase.EventDatabase_Get().Database

Server : sql1.lab.local
Type : SQLSERVER
Port : 1433
Name : od_db_evt
UserName : viewevt
Password : VMware.Hv.SecureString
TablePrefix : VE_

3. View Composer Servers This API call displays your View Composer Server details.

API Call: $global:DefaultHVServers.ExtensionData.ViewComposerHealth.ViewComposerHealth_List()
Example:
C:\> $ViewAPI = $global:DefaultHVServers.ExtensionData
C:\> $ViewAPI.ViewComposerHealth.ViewComposerHealth_List()

ServerName Port Data ConnectionServerData
---------- ---- ---- --------------------
cmp1.lab.local 18443 VMware.Hv.ViewComposerHe... {CON1, CON2}

4. Datastores This API call displays your the Datastores available in your environment.

API Call: $global:DefaultHVServers.ExtensionData.VirtualCenterHealth.VirtualCenterHealth_List().DatastoreData.Name
Example:
C:\> $ViewAPI = $global:DefaultHVServers.ExtensionData
C:\> $ViewAPI.VirtualCenterHealth.VirtualCenterHealth_List().DatastoreData.Name

datastore1
datastore1 (1)
datastore1 (2)
datastore1 (3)
vsanDatastore

5. ESXi Hosts This API call displays your the ESXi Hosts available in your environment.

API Call: $global:DefaultHVServers.ExtensionData.VirtualCenterHealth.VirtualCenterHealth_List().HostData.Name
Example:
C:\> $ViewAPI = $global:DefaultHVServers.ExtensionData
C:\> $ViewAPI.VirtualCenterHealth.VirtualCenterHealth_List().HostData.Name

esx5.lab.local
esx6.lab.local
esx7.lab.local
esx8.lab.local

6. vCenter Servers This API call displays information about your vCenter servers.

API Call: $global:DefaultHVServers.ExtensionData.VirtualCenter.VirtualCenter_List().ServerSpec
Example:
C:\> $ViewAPI = $global:DefaultHVServers.ExtensionData
C:\> $ViewAPI.VirtualCenter.VirtualCenter_List().ServerSpec

ServerName : vc1.lab.local
Port : 443
UseSSL : True
UserName : administrator@vsphere.local
Password : VMware.Hv.SecureString
ServerType : VIRTUAL_CENTER

7. Domains This API call displays the domain names users within your Horizon environment.

API Call: $global:DefaultHVServers.ExtensionData.ADDomain.ADDomain_List().NetBiosName
Example:
C:\> $ViewAPI = $global:DefaultHVServers.ExtensionData
C:\> $ViewAPI.ADDomain.ADDomain_List().NetBiosName

LAB

Catalog

Desktop Pools

Catalog-Desktop Pools-v2
1. Desktop Pools The Desktop Pools screen displays all of the Pools that are configured within your Horizon environment.

NOTE: Horizon View API - Query Service is required to capture this data. You need to use the 'DesktopSummaryView' QueryEntityType.
Example:
C:\> $ViewAPI = $global:DefaultHVServers[0].ExtensionData
C:\> $query_service = New-Object "Vmware.Hv.QueryServiceService"
C:\> $query = New-Object "Vmware.Hv.QueryDefinition"
C:\> $query.queryEntityType = 'DesktopSummaryView'
C:\> $Pools = $query_service.QueryService_Query($ViewAPI,$query)
C:\> $Pools.Results.DesktopSummaryData

Name : CorpIT-Image-IC
DisplayName : CorpIT Image v1
Enabled : True
Deleting : False
Type : AUTOMATED
Source : INSTANT_CLONE_ENGINE
UserAssignment : FLOATING
AccessGroup : VMware.Hv.AccessGroupId
GlobalEntitlement :
VirtualCenter : VMware.Hv.VirtualCenterId
ProvisioningEnabled : True
NumMachines : 2
NumSessions : 0
Farm :

Name : CorpIT-Image-v2
DisplayName : CorpIT Image v2
Enabled : True
Deleting : False
Type : AUTOMATED
Source : INSTANT_CLONE_ENGINE
UserAssignment : FLOATING
AccessGroup : VMware.Hv.AccessGroupId
GlobalEntitlement :
VirtualCenter : VMware.Hv.VirtualCenterId
ProvisioningEnabled : True
NumMachines : 2
NumSessions : 0
Farm :

Name : UEM-Pool
DisplayName : UEM-Pool
Enabled : True
Deleting : False
Type : AUTOMATED
Source : VIEW_COMPOSER
UserAssignment : FLOATING
AccessGroup : VMware.Hv.AccessGroupId
GlobalEntitlement :
VirtualCenter : VMware.Hv.VirtualCenterId
ProvisioningEnabled : True
NumMachines : 5
NumSessions : 1
Farm :

Name : WIN10-IC
DisplayName : Win10 Instant Clones
Enabled : True
Deleting : False
Type : AUTOMATED
Source : INSTANT_CLONE_ENGINE
UserAssignment : FLOATING
AccessGroup : VMware.Hv.AccessGroupId
GlobalEntitlement :
VirtualCenter : VMware.Hv.VirtualCenterId
ProvisioningEnabled : True
NumMachines : 3
NumSessions : 1
Farm :

Name : WIN10-LC
DisplayName : Win10 Linked Clones
Enabled : True
Deleting : False
Type : AUTOMATED
Source : VIEW_COMPOSER
UserAssignment : FLOATING
AccessGroup : VMware.Hv.AccessGroupId
GlobalEntitlement :
VirtualCenter : VMware.Hv.VirtualCenterId
ProvisioningEnabled : True
NumMachines : 3
NumSessions : 0
Farm :

View Configuration

Product Licensing and Usage

product licensing and usage api-v5
1. Licensing This API call displays the information shown in the Licensing box in the UI.
API Call: $global:DefaultHVServers.ExtensionData.License.License_Get()
Example:
C:\> $ViewAPI = $global:DefaultHVServers.ExtensionData
C:\> $ViewAPI.License.License_Get()

Licensed : True
LicenseKey : H100A-XXXXX-XXXXX-XXXXX-C554C
ExpirationTime :
ViewComposerEnabled : True
DesktopLaunchingEnabled : True
ApplicationLaunchingEnabled : True
InstantCloneEnabled : True
UsageModel : CONCURRENT_USER
2. Customer Experience ProgramThis API call displays the information shown in the Customer Experience Program box in the UI.
API Call: $global:DefaultHVServers.ExtensionData.CEIP.CEIP_Get()
Example:
C:\> $ViewAPI = $global:DefaultHVServers.ExtensionData
C:\> $ViewAPI.CEIP.CEIP_Get()

Enabled CompanySize Geolocation Vertical
------- ----------- ----------- --------
True SIZE_10001 AMERICA_NORTH HIGH_TECH
3. Usage This API call displays the information shown in the Usage box in the UI.
API Call: $global:DefaultHVServers.ExtensionData.ConnectionServerHealth.ConnectionServerHealth_List().ConnectionData
Example:
C:\> $ViewAPI = $global:DefaultHVServers.ExtensionData
C:\> $ViewAPI.ConnectionServerHealth.ConnectionServerHealth_List().ConnectionData

NumConnections : 55
NumConnectionsHigh : 435
NumViewComposerConnections : 55
NumViewComposerConnectionsHigh : 435
NumTunneledSessions : 11
NumPSGSessions : 0

NumConnections : 55
NumConnectionsHigh : 435
NumViewComposerConnections : 55
NumViewComposerConnectionsHigh : 435
NumTunneledSessions : 10
NumPSGSessions : 0

4. Total Named UsersThis API call displays the total amount of users entitled to a Pool/Desktop/Application.
API Call: Coming Soon......
Example:
Coming Soon......

Comments are closed.

 
Get Adobe Flash player