vmware / PowerCLI-Example-Scripts

http://blogs.vmware.com/powercli
Other
754 stars 603 forks source link

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

Open chriskoch99 opened 3 years ago

chriskoch99 commented 3 years ago

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 commented 3 years ago

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