Add Get-HVResourceStructure to display the Resouce Pool structure
Display the resource pools available to the Horizon View server
This commit is contained in:
@@ -4740,6 +4740,92 @@ function New-HVPool {
|
||||
}
|
||||
}
|
||||
|
||||
function Get-HVResourceStructure {
|
||||
<#
|
||||
.Synopsis
|
||||
Output the structure of the resource pools available to a HV. Primarily this is for debugging
|
||||
|
||||
PS> Get-HVResourceStructure
|
||||
vCenter vc.domain.local
|
||||
Container DC path /DC/host
|
||||
HostOrCluster Servers path /DC/host/Servers
|
||||
HostOrCluster VDI path /DC/host/VDI
|
||||
ResourcePool Servers path /DC/host/Servers/Resources
|
||||
ResourcePool VDI path /DC/host/VDI/Resources
|
||||
ResourcePool RP1 path /DC/host/VDI/Resources/RP1
|
||||
ResourcePool RP2 path /DC/host/VDI/Resources/RP1/RP2
|
||||
|
||||
Author : Mark Elvers <mark.elvers@tunbury.org>
|
||||
#>
|
||||
param(
|
||||
[Parameter(Mandatory = $false)]
|
||||
$HvServer = $null
|
||||
)
|
||||
begin {
|
||||
$services = Get-ViewAPIService -hvServer $HvServer
|
||||
if ($null -eq $services) {
|
||||
Write-Error "Could not retrieve ViewApi services from connection object"
|
||||
break
|
||||
}
|
||||
}
|
||||
process {
|
||||
$vc_service_helper = New-Object VMware.Hv.VirtualCenterService
|
||||
$vcList = $vc_service_helper.VirtualCenter_List($services)
|
||||
foreach ($vc in $vcList) {
|
||||
Write-Host vCenter $vc.ServerSpec.ServerName
|
||||
$datacenterList = @{}
|
||||
$BaseImage_service_helper = New-Object VMware.Hv.BaseImageVmService
|
||||
$parentList = $BaseImage_service_helper.BaseImageVm_List($services, $vc.id)
|
||||
foreach ($possibleParent in $parentList) {
|
||||
if (-not $datacenterList.ContainsKey($possibleParent.datacenter.id)) {
|
||||
$datacenterList.Add($possibleParent.datacenter.id, $possibleParent.datacenter)
|
||||
}
|
||||
if (0) {
|
||||
Write-Host "$($possibleParent.name): " -NoNewLine
|
||||
if ($possibleParent.incompatibleReasons.inUseByDesktop) { Write-Host "inUseByDesktop, " -NoNewLine }
|
||||
if ($possibleParent.incompatibleReasons.viewComposerReplica) { Write-Host "viewComposerReplica, " -NoNewLine }
|
||||
if ($possibleParent.incompatibleReasons.inUseByLinkedCloneDesktop) { Write-Host "inUseByLinkedCloneDesktop, " -NoNewLine }
|
||||
if ($possibleParent.incompatibleReasons.unsupportedOSForLinkedCloneFarm) { Write-Host "unsupportedOSForLinkedCloneFarm, " -NoNewLine }
|
||||
if ($possibleParent.incompatibleReasons.unsupportedOS) { Write-Host "unsupportedOS, " -NoNewLine }
|
||||
if ($possibleParent.incompatibleReasons.noSnapshots) { Write-Host "noSnapshots, " -NoNewLine }
|
||||
Write-Host
|
||||
}
|
||||
}
|
||||
$hcNodes = @()
|
||||
$index = 0
|
||||
foreach ($datacenter in $datacenterList.keys) {
|
||||
$HostOrCluster_service_helper = New-Object VMware.Hv.HostOrClusterService
|
||||
$hcNodes += $HostOrCluster_service_helper.HostOrCluster_GetHostOrClusterTree($services, $datacenterList.$datacenter)
|
||||
while ($index -lt $hcNodes.length) {
|
||||
if ($hcNodes[$index].container) {
|
||||
Write-Host "Container" $hcNodes[$index].treecontainer.name "path" $hcNodes[$index].treecontainer.path
|
||||
if ($hcNodes[$index].treecontainer.children.Length) { $hcNodes += $hcNodes[$index].treecontainer.children }
|
||||
} else {
|
||||
Write-Host "HostOrCluster" $hcNodes[$index].info.name "path" $hcNodes[$index].info.path
|
||||
}
|
||||
$index++
|
||||
}
|
||||
}
|
||||
$rpNodes = @()
|
||||
$index = 0
|
||||
foreach ($hostOrCluster in $hcNodes) {
|
||||
if (-not $hostOrCluster.container) {
|
||||
$ResourcePool_service_helper = New-Object VMware.Hv.ResourcePoolService
|
||||
$rpNodes += $ResourcePool_service_helper.ResourcePool_GetResourcePoolTree($services, $hostOrCluster.info.id)
|
||||
while ($index -lt $rpNodes.length) {
|
||||
Write-Host "ResourcePool" $rpNodes[$index].resourcePoolData.name "path" $rpNodes[$index].resourcePoolData.path
|
||||
if ($rpNodes[$index].children.Length) { $rpNodes += $rpNodes[$index].children }
|
||||
$index++
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end {
|
||||
[System.gc]::collect()
|
||||
}
|
||||
}
|
||||
|
||||
function Get-HVPoolProvisioningData {
|
||||
param(
|
||||
[Parameter(Mandatory = $false)]
|
||||
@@ -9736,4 +9822,4 @@ function Set-HVGlobalSettings {
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user