Removed get-hvpodsession, added get-hvglobalsession
get-hvpodsession only got a count + naming was incorrect (it was global but name said pod) get-hvglobalsession actually enumerates all global sessions
This commit is contained in:
@@ -9152,68 +9152,67 @@ function Remove-HVGlobalEntitlement {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-HVPodSession {
|
function Get-HVGlobalSession {
|
||||||
<#
|
<#
|
||||||
.Synopsis
|
.SYNOPSIS
|
||||||
Gets the total amount of sessions for all Pods in a Federation
|
Provides a list with all Global sessions in a Cloud Pod Architecture
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
Gets the total amout of current sessions (connected and disconnected) for all Pods in a Federation (CPA)
|
The get-hvglobalsession gets all local session by using view API service object(hvServer) of Connect-HVServer cmdlet.
|
||||||
based on the global query service.
|
|
||||||
The default object response is used which contains both success and fault information as well as the
|
|
||||||
session count per pod and the ID of each pod.
|
|
||||||
.PARAMETER HvServer
|
.PARAMETER HvServer
|
||||||
Reference to Horizon View Server to query the virtual machines from. If the value is not passed or null then
|
View API service object of Connect-HVServer cmdlet.
|
||||||
first element from global:DefaultHVServers would be considered inplace of hvServer
|
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-HVPodSession
|
Get-hvglobalsession
|
||||||
|
Gets all global sessions
|
||||||
.OUTPUTS
|
|
||||||
Returns list of objects of type GlobalSessionPodSessionCounter
|
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
Author : Rasmus Sjoerslev
|
Author : Wouter Kursten.
|
||||||
Author email : rasmus.sjorslev@vmware.com
|
Author email : wouter@retouw.nl
|
||||||
Version : 1.0
|
Version : 1.0
|
||||||
|
|
||||||
===Tested Against Environment====
|
===Tested Against Environment====
|
||||||
Horizon View Server Version : 7.0.2
|
Horizon View Server Version : 7.0.2, 7.1.0, 7.3.2
|
||||||
PowerCLI Version : PowerCLI 6.5
|
PowerCLI Version : PowerCLI 6.5, PowerCLI 6.5.1
|
||||||
PowerShell Version : 5.0
|
PowerShell Version : 5.0
|
||||||
#>
|
|
||||||
|
|
||||||
[CmdletBinding(
|
#>
|
||||||
SupportsShouldProcess = $true,
|
[CmdletBinding(
|
||||||
ConfirmImpact = 'High'
|
SupportsShouldProcess = $true,
|
||||||
)]
|
ConfirmImpact = 'High'
|
||||||
|
)]
|
||||||
|
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory = $false)]
|
[Parameter(Mandatory = $false)]
|
||||||
$HvServer = $null
|
$HvServer = $null
|
||||||
)
|
)
|
||||||
|
|
||||||
$services = Get-ViewAPIService -hvServer $hvServer
|
$services = Get-ViewAPIService -HvServer $HvServer
|
||||||
if ($null -eq $services) {
|
if ($null -eq $services) {
|
||||||
Write-Error "Could not retrieve ViewApi services from connection object"
|
Write-Error "Could not retrieve ViewApi services from connection object."
|
||||||
break
|
break
|
||||||
}
|
|
||||||
|
|
||||||
$query_service_helper = New-Object VMware.Hv.GlobalSessionQueryServiceService
|
|
||||||
$count_spec = New-Object VMware.Hv.GlobalSessionQueryServiceCountSpec
|
|
||||||
$queryResults = @()
|
|
||||||
|
|
||||||
foreach ($pod in $services.Pod.Pod_List()) {
|
|
||||||
$count_spec.Pod = $pod.Id
|
|
||||||
$info = $query_service_helper.GlobalSessionQueryService_GetCountWithSpec($services,$count_spec)
|
|
||||||
|
|
||||||
foreach ($res in $info) {
|
|
||||||
if ($pod.Id.Id -eq $res.Id.Id) {
|
|
||||||
$queryResults += $res
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $queryResults
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$query_service_helper = New-Object VMware.Hv.GlobalSessionQueryServiceService
|
||||||
|
$query=new-object vmware.hv.GlobalSessionQueryServiceQuerySpec
|
||||||
|
|
||||||
|
$SessionList = @()
|
||||||
|
$GetNext = $false
|
||||||
|
foreach ($pod in $services.Pod.Pod_List()) {
|
||||||
|
$query.pod=$pod.id
|
||||||
|
$queryResults = $query_service_helper.GlobalSessionQueryService_QueryWithSpec($services, $query)
|
||||||
|
do {
|
||||||
|
if ($GetNext) { $queryResults = $query_service_helper.GlobalSessionQueryService_GetNext($services, $queryResults.id) }
|
||||||
|
$SessionList += $queryResults.results
|
||||||
|
$GetNext = $true
|
||||||
|
} while ($queryResults.remainingCount -gt 0)
|
||||||
|
$query_service_helper.GlobalSessionQueryService_Delete($services, $queryresults.id)
|
||||||
|
|
||||||
|
}
|
||||||
|
return $sessionlist
|
||||||
|
}
|
||||||
|
|
||||||
function Set-HVApplicationIcon {
|
function Set-HVApplicationIcon {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
@@ -9888,4 +9887,4 @@ The get-hvlocalsession gets all local session by using view API service object(h
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Export-ModuleMember Add-HVDesktop,Add-HVRDSServer,Connect-HVEvent,Disconnect-HVEvent,Get-HVPoolSpec,Get-HVInternalName, Get-HVEvent,Get-HVFarm,Get-HVFarmSummary,Get-HVPool,Get-HVPoolSummary,Get-HVMachine,Get-HVMachineSummary,Get-HVQueryResult,Get-HVQueryFilter,New-HVFarm,New-HVPool,Remove-HVFarm,Remove-HVPool,Set-HVFarm,Set-HVPool,Start-HVFarm,Start-HVPool,New-HVEntitlement,Get-HVEntitlement,Remove-HVEntitlement, Set-HVMachine, New-HVGlobalEntitlement, Remove-HVGlobalEntitlement, Get-HVGlobalEntitlement, Get-HVPodSession, Set-HVApplicationIcon, Remove-HVApplicationIcon, Get-HVGlobalSettings, Set-HVGlobalSettings, Set-HVGlobalEntitlement, Get-HVResourceStructure, Get-hvlocalsession
|
Export-ModuleMember Add-HVDesktop,Add-HVRDSServer,Connect-HVEvent,Disconnect-HVEvent,Get-HVPoolSpec,Get-HVInternalName, Get-HVEvent,Get-HVFarm,Get-HVFarmSummary,Get-HVPool,Get-HVPoolSummary,Get-HVMachine,Get-HVMachineSummary,Get-HVQueryResult,Get-HVQueryFilter,New-HVFarm,New-HVPool,Remove-HVFarm,Remove-HVPool,Set-HVFarm,Set-HVPool,Start-HVFarm,Start-HVPool,New-HVEntitlement,Get-HVEntitlement,Remove-HVEntitlement, Set-HVMachine, New-HVGlobalEntitlement, Remove-HVGlobalEntitlement, Get-HVGlobalEntitlement, Set-HVApplicationIcon, Remove-HVApplicationIcon, Get-HVGlobalSettings, Set-HVGlobalSettings, Set-HVGlobalEntitlement, Get-HVResourceStructure, Get-hvlocalsession, Get-HVGlobalSession
|
||||||
|
|||||||
Reference in New Issue
Block a user