Sometimes it is handy to list all of the associations between Horizon Application Pools to Global Entitlements. Here is a quick function I wrote to do so! Introducing Get-HVAppsToGEs.

You must first install the HVHelper Modules with PowerCLI, as well as a really cool module called Join-Object for performing SQL-like joins within two PowerShell arrays. This is required because the relationship is based on the Global Entitlement ID, but we want to translate this to the readable name.

 # Get apps to Global Entitlement associations. Requires Join-Object module and HVHelper module from PowerCLI.
# Run "Install-Module -Name Join-Object -RequiredVersion 2.0.1" for join-object module install.
# Connect to pod using Connect-HVServer prior to execution. 
# Function written by Nick Burton - nicksitblog.com

Function Get-HVAppsToGEs {

# Get app info

$hvapps = Get-HVApplication
$appInfo=@()

foreach ($hvapp in $hvapps)

{
$appInfo+= New-Object PSObject -Property @{
"AppName" = $hvapp.Data.Name;
"AssignedGE" = $hvapp.Data.GlobalApplicationEntitlement.Id;
                        }
}

# Get global entitlement info

$hvGEs = Get-HVGlobalEntitlement
$GEInfo = @()

foreach ($HVGE in $HVGEs)

{
$GEInfo+= New-Object PSObject -Property @{
"Name" = $HVGE.Base.DisplayName;
"GEID" = $HVGE.Id.Id;
                        }
}

$JoinParams = @{
    Left              = $appInfo
    Right             = $GEInfo
    LeftJoinProperty  = 'AssignedGE'
    RightJoinProperty = 'GEID'
    Type              = 'OnlyIfInBoth'
    Prefix            = 'GE_'
}
Join-Object @JoinParams | select AppName,GE_Name
} 

Here’s what the result looks like:

Enjoy! I’ll likely follow this up with a Desktop Pool-to-GE script later.

UPDATE: As promised, here is the desktop pool-to-GE version.