freydaddy's Accepted Solutions

Another example, not tested as I don't have access to an environment with more than 1000 users at the moment, but this should be close. Note that we are using QueryService_Create() method to init... See more...
Another example, not tested as I don't have access to an environment with more than 1000 users at the moment, but this should be close. Note that we are using QueryService_Create() method to initiate the query, instead of QueryService_Query(). It's also important to use QueryService_Delete() to free up server side resources, once you're finished. function Get-AllHvUsers ($services) {    $results = @()    $queryService = new-object VMware.Hv.QueryServiceService    $queryDefinition = New-Object VMware.Hv.QueryDefinition    $queryDefinition.QueryEntityType = "ADUserOrGroupSummaryView"    $curResults = $queryService.QueryService_Create($services, $queryDefinition)    $results += $curResults.Results    if($curResults.RemainingCount -gt 0) {    do {    $queryResponse = $queryService.QueryService_GetNext($services,$curResults.Id)    $results += $queryResponse.Results    $remaining = $queryResponse.RemainingCount   } while { $remaining -gt 0 }   }    $queryService.QueryService_Delete($services, $curResults.Id)    return $results }