VMware Horizon: manually removing orphaned or stale virtual desktops

removingorphanedstalevdi01

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.

removingorphanedstalevdi02

Click OK to proceed.

removingorphanedstalevdi03

This is one type of error you can experience. in the example the vCenter Server is corrupted and the machine cannot be removed.

removingorphanedstalevdi04

 

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.

removingorphanedstalevdi05

Right click the ADSI Edit item and select Connect to...

removingorphanedstalevdi06

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.

removingorphanedstalevdi07

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.

removingorphanedstalevdi08

In the View Administrators group enter the account to entitle then click OK.

removingorphanedstalevdi09

The connection to the ADAM database is now successful.

removingorphanedstalevdi10

Right click the View ADAM Database and select New > Query...

removingorphanedstalevdi11

Give the query a Name (i.e. VDI) and click Browse. Select Servers and click OK.

removingorphanedstalevdi12

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))

removingorphanedstalevdi13

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

removingorphanedstalevdi14

Double click the CN object and check if the pae-DisplayName reflects the name assigned to the VDI. Click OK.

removingorphanedstalevdi15

In the Servers OU, locate the entry with the same CN.

removingorphanedstalevdi16

Again, double click the CN object and check if the pae-DisplayName reflects the name assigned to the VDI then click OK.

removingorphanedstalevdi17

Right click the verified CN object and select Delete.

removingorphanedstalevdi18

 

Click Yes to confirm.

removingorphanedstalevdi19

The object has been removed from the ADAM Database.

removingorphanedstalevdi20

When you refresh the Horizon View Administrator screen, the orphaned virtual desktop has been removed.

removingorphanedstalevdi21

 

Clean Active Directory

Remove the computer also from the Active Directory.

removingorphanedstalevdi22

Click Yes to confirm.

removingorphanedstalevdi23

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.

signature