VMware View Pool Entitelement Cleanup
When you unassign a VM from a user in VMware View pool, the user name not be deleted from “Pool Entitlement”,
If you checked “Enable Auto Assignment” in you pool settings and the user send a request to the pool, View will assign a new VM (Mostly spare VM) to the user, this is a misconfiguration.
You can delete users which don’t have VM on the pool for the pool entitlement by this script:
# By Davoud Teimouri v0.1 CLS #Clear screen Write-Host("This script will clean your pool from unassigned users") $PoolID=Read-Host ("Please enter PoolID") #Get PoolID from the user (Sometimes PoolID is same as pool name $Users=Get-PoolEntitlement -pool_id $PoolID | Select-Object displayname #Query pool's users and store them to $Users Foreach ($User in $USers) { $User=$User.displayname $RUser=$User.Substring(15) #Change this based on your domain name Write-Host ("Proccessing on: " + $RUser) -foregroundcolor "Green" Write-Host $VM=Get-DesktopVM -pool_id $PoolID | Select-Object user_displayname | Where-Object {$_.user_displayname -eq $User} If ($VM -eq $Null) { Get-User -name $RUser | Where-Object {$_.displayname -eq $user} |Remove-PoolEntitlement -pool_id $PoolID | Out-Null Write-Host ($User + " has been removed from " + $PoolID) -foregroundcolor "Red" Write-Host } }
This script should run on View server directly.
[quotes_and_tips]