VMware Cloud Community
sjesse
Leadership
Leadership
Jump to solution

Horizon vCheck Plugin issue

Hi, I did reach out to the maintainer, but was wondering if someone else could take a look and hopefully share what I'm missing. The 14 Manually Desktop Pool Information plugin isn't working, and neither are any of the other ones, and I think its all the same problem. Running this set of code block

$queryservice=new-object vmware.hv.queryserviceservice

$defn = New-Object VMware.Hv.QueryDefinition

$defn.queryentitytype='MachineSummaryView'

$filter = New-Object VMware.Hv.QueryFilterEquals -Property @{ 'memberName' = 'base.name'; 'value' = "$pool.base.name" }

$queryResults = $queryService.QueryService_Create($Services1, $defn)

$desktops=$queryResults.results

Doesn't get desktops from the correct desktop pool, it seems to grab all the vms that have people logged into.The git repo is

vCheck-HorizonView/Plugins/20 Desktop at master · vCheckReport/vCheck-HorizonView · GitHub

Thanks for any help

0 Kudos
1 Solution

Accepted Solutions
sjesse
Leadership
Leadership
Jump to solution

I had to remove the " from $pool id and the filter started working. Thanks again for the suggestion.

View solution in original post

0 Kudos
3 Replies
LucD
Leadership
Leadership
Jump to solution

Did you already try changing "$pool.base.name" into "$($pool.base.name)"?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
sjesse
Leadership
Leadership
Jump to solution

Thank LucD​, that doesn't help. The filter wasn't being used, but if I keep the filter the same it returns nothing.Talking with the maintiner he noticed the filter wasn't applied, so we fix it, but now filter doesn't fine anything. I think the issue is you can't match base.name in from the machines to the pool.base.name you need to match the base.desktop.id to the pool.id value. I tried this

$filter = New-Object VMware.Hv.QueryFilterEquals -Property @{ 'memberName' = 'base.desktop.id'; 'value' = "$pool.id" }

but I get an error that says one base.desktop.id is an invalid type, even though its in the api

View API - VMware API Explorer - VMware {code}

I made a workaround which works but I'd like to understand the horizon api more if anyone knows. If I leave the filter blank again like before so it gets all the desktops adn then insert this right after $desktops=$queryResults.results, I get what I expect

$filteredDesktops=@()

foreach($desktop in $desktops)

{

$desktopPoolId=$desktop.Base.Desktop.Id.ToString()

$poolId=$pool.id.Id.ToString()

if($desktopPoolId -eq $poolId)

{

$filteredDesktops+=$desktop

}

}

$desktops=$filteredDesktops

0 Kudos
sjesse
Leadership
Leadership
Jump to solution

I had to remove the " from $pool id and the filter started working. Thanks again for the suggestion.

0 Kudos