Skip to content

Commit a20d1ed

Browse files
authored
Merge pull request #73 from rayheffer/patch-1
Create Horizon-UsageStats.ps1
2 parents bc9c52d + bd2edd6 commit a20d1ed

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

Scripts/Horizon-GetUsageStats.ps1

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<#
2+
.NOTES
3+
Script name: Horizon-UsageStats.ps1
4+
Author: Ray Heffer, @rayheffer
5+
Last Edited on: 04/18/2017
6+
Dependencies: PowerCLI 6.5 R1 or later, Horizon 7.0.2 or later
7+
.DESCRIPTION
8+
This is a sample script that retrieves the Horizon usage statistics. This produces the same metrics as listed under View Configuration > Product Licensing and Usage. Service providers can use this script or incorporate it with their existing scripts to automate the reporting of Horizon usage.
9+
10+
Example Output:
11+
NumConnections : 180
12+
NumConnectionsHigh : 250
13+
NumViewComposerConnections : 0
14+
NumViewComposerConnectionsHigh : 0
15+
NumTunneledSessions : 0
16+
NumPSGSessions : 180
17+
#>
18+
19+
# User Configuration
20+
$hzUser = "Administrator"
21+
$hzPass = "VMware1!"
22+
$hzDomain = "vmw.lab"
23+
$hzConn = "connect01.vmw.lab"
24+
25+
# Import the Horizon module
26+
Import-Module VMware.VimAutomation.HorizonView
27+
28+
# Establish connection to Connection Server
29+
$hvServer = Connect-HVServer -server $hzConn -User $hzUser -Password $hzPass -Domain $hzDomain
30+
31+
# Assign a variable to obtain the API Extension Data
32+
$hvServices = $Global:DefaultHVServers.ExtensionData
33+
34+
# Retrieve Connection Server Health metrics
35+
$hvHealth =$hvServices.ConnectionServerHealth.ConnectionServerHealth_List()
36+
37+
# Display ConnectionData (Usage stats)
38+
$hvHealth.ConnectionData

0 commit comments

Comments
 (0)