Horizon sometimes fails to process some VMs leaving orphaned or stale virtual desktops in pools that cannot be removed from the GUI.
Manually removing orphaned or stale virtual desktops from the vCenter is not enough to clean the VMware View Manager and its database.
Remove the VDI
From the Horizon View Administrator, right click the machine to delete and click Remove.
Click OK to proceed.
This is one type of error you can experience. in the example the vCenter Server is corrupted and the machine cannot be removed.
Clean ADAM database
To remove the orphaned VM, the View database must be cleaned in order to remove all the entries no longer needed. From the Horizon Connection Server, open the ADSI Edit.
Right click the ADSI Edit item and select Connect to...
In the Connection Settings window, enter the following parameters:
Name: View ADAM Database
Connection Point: dc=vdi,dc=vmware,dc=int
Computer: localhost:389
Click OK to confirm.
If the connection to the ADAM database fails, one reason could be that the user logged in the Connection Server doesn't have the correct permissions to administer VMware View.
In the View Administrators group enter the account to entitle then click OK.
The connection to the ADAM database is now successful.
Right click the View ADAM Database and select New > Query...
Give the query a Name (i.e. VDI) and click Browse. Select Servers and click OK.
Enter the string below in the Query String field specifying the orphaned VM name. Click OK to execute the query.
(&(objectClass=pae-VM)(pae-displayname=VM_to_remove))
i.e. (&(objectClass=pae-VM)(pae-displayname=view-lab-1))
As result, a new ADSI Edit item appears at the bottom of the window (VDI). Take note of the CN string in the right pane.
i.e. CN=ccbace2f-e506-48c4-8248-d92d5821876a
Double click the CN object and check if the pae-DisplayName reflects the name assigned to the VDI. Click OK.
In the Servers OU, locate the entry with the same CN.
Again, double click the CN object and check if the pae-DisplayName reflects the name assigned to the VDI then click OK.
Right click the verified CN object and select Delete.
Click Yes to confirm.
The object has been removed from the ADAM Database.
When you refresh the Horizon View Administrator screen, the orphaned virtual desktop has been removed.
Clean Active Directory
Remove the computer also from the Active Directory.
Click Yes to confirm.
In this procedure the old vCenter Server was corrupted and the Horizon View database installed in the same VM was not available as well. To complete the overall procedure, the orphaned VM should be removed also from the vCenter Server and the Horizon View database.