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