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 These API calls lists your Horizon Connection Server details
dashboard-system health-connection servers-v2

A. API Call: $global:DefaultHVServers.ExtensionData.ConnectionServer.ConnectionServer_List().General
B. API Call: $global:DefaultHVServers.ExtensionData.ConnectionServer.ConnectionServer_List().CertificateHealth
C. API Call: $global:DefaultHVServers.ExtensionData.ConnectionServer.ConnectionServer_List().ConnectionData.NumConnections
D. API Call: Coming Soon...
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

C:\> $ViewAPI.ConnectionServer.ConnectionServer_List().CertificateHealth

Valid StartTime ExpirationTime InvalidReason
----- --------- -------------- -------------
False 5/9/2016 3:11:05 AM 5/7/2026 3:11:05 AM NOT_TRUSTED
False 5/9/2016 3:57:28 AM 5/7/2026 3:57:28 AM NOT_TRUSTED

C:\> $ViewAPI.ConnectionServerHealth.ConnectionServerHealth_List().ConnectionData.NumConnections

0

2. Event Database These API calls displays your Event Database details.

dashboard-system health-events_database-v2
A. API Call: $global:DefaultHVServers.ExtensionData.EventDatabaseHealth.EventDatabaseHealth_Get().Data
B. API Call: $global:DefaultHVServers.ExtensionData.EventDatabase.EventDatabase_Get().Database
Example:
C:\> $ViewAPI = $global:DefaultHVServers.ExtensionData
C:\> $ViewAPI.EventDatabaseHealth.EventDatabaseHealth_Get().Data

ServerName : sql1.lab.local
Port : 1433
DatabaseType : SQLSERVER
UserName : viewevt
DatabaseName : od_db_evt
TablePrefix : VE_
State : CONNECTED
Error :

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 These API calls display your View Composer Server details and health.

dashboard-system health-composer-v2
A. API Call: $global:DefaultHVServers.ExtensionData.ViewComposerHealth.ViewComposerHealth_List()
B. API Call: $global:DefaultHVServers.ExtensionData.ViewComposerHealth.ViewComposerHealth_List().ConnectionServerData
C. API Call: $global:DefaultHVServers.ExtensionData.ViewComposerHealth.ViewComposerHealth_List().Data
Example:
C:\> $ViewAPI = $global:DefaultHVServers.ExtensionData
C:\> $ViewAPI.ViewComposerHealth.ViewComposerHealth_List()

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

C:\> $ViewAPI.ViewComposerHealth.ViewComposerHealth_List().ConnectionServerData

Id : VMware.Hv.ConnectionServerId
Name : CON1
Status : OK
ErrorMessage :
ThumbprintAccepted : True
CertificateHealth : VMware.Hv.CertificateHealthData

Id : VMware.Hv.ConnectionServerId
Name : CON2
Status : OK
ErrorMessage :
ThumbprintAccepted : True
CertificateHealth : VMware.Hv.CertificateHealthData

C:\> $ViewAPI.ViewComposerHealth.ViewComposerHealth_List().Data

VirtualCenters : {VirtualCenter/OWVkMjE3YzAtYzRiYS00YWNhLTgyMWItODg0N2Q0OTBjMGEw}
Version : 7.0.2.25237
Build : 4350300
ApiVersion : 3.5
MinVCVersion : 4.0.0
MinESXVersion : 4.0.0

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
Example:
C:\> $ViewAPI = $global:DefaultHVServers.ExtensionData
C:\> $ViewAPI.VirtualCenterHealth.VirtualCenterHealth_List().HostData

Name : esx5.lab.local
Version : 6.0.0
ApiVersion : 6.0
Status : CONNECTED
ClusterName : usa1-1-vc1c1
VGPUTypes :

Name : esx6.lab.local
Version : 6.0.0
ApiVersion : 6.0
Status : CONNECTED
ClusterName : usa1-1-vc1c1
VGPUTypes :

Name : esx7.lab.local
Version : 6.0.0
ApiVersion : 6.0
Status : CONNECTED
ClusterName : usa1-1-vc1c1
VGPUTypes :

Name : esx8.lab.local
Version : 6.0.0
ApiVersion : 6.0
Status : CONNECTED
ClusterName : usa1-1-vc1c1
VGPUTypes :

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 These API calls display the Domain information and health within your Horizon environment.

dashboard-system health-domain-v2

A. API Call: $global:DefaultHVServers.ExtensionData.ADDomain.ADDomain_List().NetBiosName
B. API Call: $global:DefaultHVServers.ExtensionData.ADDomainHealth.ADDomainHealth_List().ConnectionServerState.TrustRelationship
C. API Call: $global:DefaultHVServers.ExtensionData.ADDomainHealth.ADDomainHealth_List().ConnectionServerState.TrustRelationship
Example:
C:\> $ViewAPI = $global:DefaultHVServers.ExtensionData
C:\> $ViewAPI.ADDomain.ADDomain_List().NetBiosName

LAB

C:\> $ViewAPI.ADDomain.ADDomainHealth.ADDomainHealth_List().ConnectionServerState.TrustRelationship

Id : VMware.Hv.ConnectionServerId
ConnectionServerName : CON1
Status : OK
TrustRelationship : PRIMARYDOMAIN
Contactable : FULLYACCESSIBLE

Id : VMware.Hv.ConnectionServerId
ConnectionServerName : CON2
Status : OK
TrustRelationship : PRIMARYDOMAIN
Contactable : FULLYACCESSIBLE

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