PowerCLI-Example-Scripts icon indicating copy to clipboard operation
PowerCLI-Example-Scripts copied to clipboard

Get-HVEntitlement -ResourceType Desktop

Open houk001 opened this issue 5 years ago • 2 comments

On Example there is option to show Entitlements per Application When i run Get-HVEntitlement -ResourceType Desktop or Get-HVEntitlement -ResourceType Application i get error

Get-HVQueryFilter : Cannot bind argument to parameter 'Filters' because it is an empty array. At C:\Program Files\WindowsPowerShell\Modules\VMware.Hv.Helper\VMware.HV.Helper.psm1:8457 char:54 $AndFilter = Get-HVQueryFilter -And -Filters $AndFilter ~~~~~~~~~~ CategoryInfo : InvalidData: (:) [Get-HVQueryFilter], ParameterBindingValidationException FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyArrayNotAllowed,Get-HVQueryFilter

Get-HVQueryResult : Cannot process argument transformation on parameter 'Filter'. Cannot convert the "System.Object[]" value of type "System.Object[]" to type "VMware.Hv.QueryFilter". At C:\Program Files\WindowsPowerShell\Modules\VMware.Hv.Helper\VMware.HV.Helper.psm1:8458 char:95 ... tyType EntitledUserOrGroupLocalSummaryView -Filter $AndFilter -HvServ ... ~~~~~~~~~~ CategoryInfo : InvalidData: (:) [Get-HVQueryResult], ParameterBindingArgumentTransformationException FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-HVQueryResult

but when i run not existing resource type there is a info about proper types

Get-HVEntitlement -ResourceType App Get-HVEntitlement : Cannot validate argument on parameter 'ResourceType'. The argument "App" does not belong to th e set "Application;Desktop;GlobalApplicationEntitlement;GlobalEntitlement;URLRedirection" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again. At line:1 char:33 Get-HVEntitlement -ResourceType Applicat ~~~~~~~~ CategoryInfo : InvalidData: (:) [Get-HVEntitlement], ParameterBindingValidationException FullyQualifiedErrorId : ParameterArgumentValidationError,Get-HVEntitlement

Horizon version 7.11 VMware.Hv.Helper 1.3.1

houk001 avatar May 20 '20 15:05 houk001

Hi,

The function expects at least one of “User” or “ResourceName” parameter. The below example script works:

$appEntitlements = Get-HVEntitlement -ResourceType Application -ResourceName 'AppPool' Write-Host 'App entitlements:'; foreach ($info in $appEntitlements) { Write-Host $info.id.id; }

psurad avatar May 22 '20 12:05 psurad

Then please remove from get-help Get-HVEntitlement -examples a example of usage with only -ResourceType. With old View get-entitlement there is a option to get all of entitlements with pool list, This is very useful to export all of users or group with one command to other systems.

houk001 avatar May 22 '20 19:05 houk001