VMware Horizon Community
butlpau02
Contributor
Contributor

Horizion 7 Powercli : Delete Over-Provisioned Desktops CPA

Hi Guys,

Is there an easy way to create a Powershell script to delete excess floating linked clone desktops in the Pool that are greater than the minimum number of desktops? 

Scenario:

Have a quick question please - my environment : Horizon 7 CPA, 2 Floating Linked Clone Pools Split 50/50 across 2 PODs - one Global Entitlement encompassing both Pools - refresh on logoff.

Lets say : Min Pool Size set to 500 and Max Pool size set to 1000 on each of the Pools.  So in theory, each Pool can burst up to 1000 desktops in the case of one of the PODs becoming inaccessible.

Works well.  However, due to load-balancing (NAT-ing issue, separate topic), these Pools become loaded on one side and then the other from day to day.  Could be 800 Users connected in one Pool (and 200 in the other) one day, and then vice versa the next day.  As each of these Floating Pools grow in size - now say 800 in each, they are not reduced automatically.

I don't want to use the delete on logoff option for various reasons.

Is there an easy way to create a Powershell script to delete excess (say 300) floating linked clone desktops in the Pool that are greater than the minimum number of desktops (500)?

The criteria would be that these desktops would also need to be in a not "Connected" state as don't want to have Users affected when running the script.

I'd look to schedule this to run once or twice a week on off-peak times.

Thanks a million,

Paul.

Reply
0 Kudos
1 Reply
butlpau02
Contributor
Contributor

Hi Again,

Haven't got the syntax correct yet, but am thinking along the lines of the below:

Export $desktopsavailable into Array (Sort descending deleting highest desktop name/number first) (check if >1)


$ProvisioningDifference = OverProvisionedDesktops-MinDesktops (check if >1, could be =0, no over provisioning - in that case move on...)

Find out which is lower - AvailableDesktops.count and ProvisioningDifference = $Max2Delete

For [x] = 1 to $Max2Delete Do
delete-vm $desktopsavailable [x]
Next

Move onto next Pool, - type = FLOATING

Reply
0 Kudos