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

Get-HVEntitlement shows users and groups when specifying -Type User

Open chriskoch99 opened this issue 4 years ago • 1 comments

Trying to separately get lists of users or groups entitled to certain applications.

Running the following command lists Active Directory groups entitled to MyAppID: (Get-HVEntitlement -ResourceName "MyAppID" -ResourceType Application -Type Group).base.name

Running the following command shows both Active Directory users and groups, but should only show users unless I've misunderstood the command: (Get-HVEntitlement -ResourceName "MyAppID" -ResourceType Application -Type User).base.name

Anybody else see this?

chriskoch99 avatar Mar 01 '21 00:03 chriskoch99

On my own system I was able to resolve this editing the Get-HVEntitlement function the following ways:

  1. In the Parameters section, replace $Type = 'User', with $Type,
  2. In the Process section, replace if ($type -eq 'group'){ with if ($type){

With these changes in place the behavior is the following: If -Type is not specified, show both user and group entitlements If -Type User is specified, show user entitlements only If -Type Group is specified, show group entitlements only

Hope this helps

chriskoch99 avatar Mar 01 '21 01:03 chriskoch99