As promised from my last post, here is the function for listing Desktop Pools to their associated Global Entitlements – Get-HVPoolsToGEs. Enjoy!
# Get desktop pools 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-HVPoolsToGEs {
# Get app info
$hvpools = Get-HVPool
$poolInfo=@()
foreach ($hvpool in $hvpools)
{
$poolInfo+= New-Object PSObject -Property @{
"PoolName" = $hvpool.Base.Name;
"AssignedGE" = $hvpool.GlobalEntitlementData.GlobalEntitlement.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 = $poolInfo
Right = $GEInfo
LeftJoinProperty = 'AssignedGE'
RightJoinProperty = 'GEID'
Type = 'OnlyIfInBoth'
Prefix = 'GE_'
}
Join-Object @JoinParams | select PoolName,GE_Name
}