Introduction
In this article I will describe how to remove Instant Clone objects created in VMware Horizon DaaS from your vCenter Server.
I had to do this because I (on one of those famous rough Monday mornings 😉 ) deleted one of my demo tenants in VMware Horizon DaaS without properly clean the tenant first.
Note to self: kill the VDI’s first, than remove the images, etc. properly and THAN delete the tenant!
Unfortunately this wasn’t a very clever move because you can’t delete the remaining objects afterwards due to a lock in the database:

This can be avoided by changing the capacity of the desktop pools to 0 and convert/delete the images before you delete your tenant from the Horizon DaaS Service center.
| Beware! If these actions are outside your comfort zone, reach out to the VMware Support team to assist you with this. When you delete the wrong objects, there will be consequences. |
Preparation
First, you need gather a list of cp-xxx objects you want to remove from the vCenter Server. I did this by listing all the VM objects sitting in the remaining desktop VLAN of my deleted tenant.
Now, export them to a Excel/CSV file.
In the second part of this article we will add a column to the file, so a clear overview is advised.
You can use the Data > “Text to columns” option in Excel to make the list more clear to read. My list looked like this:

Log on to the vCenter Server MOB.
To do this, type the following behind the FQDN of your vCenter Server: /mob/?vmodl=1.
Example: https://vcsa-fqdn/mob/?vmodl=1
After you logged on (use the administrator@vsphere.local account, or equal privileges) to the MOB, Browse to Content.
Navigate to the rootFolder > vim.folder > group-d1 (Datacenters)
We need to navigate to the datacenter where your cp-xxx objects are located: Navigate to childEntity > vim.ManagedEntity[] > datacenter-21 (Name of your DataCenter)
Next step is to find the datastore where the cp-xxx objects are stored.In my situation it’s a NFS datastore: vim.Datastore[] > datastore-56
Once there, browse to the vm – vim.VirtualMachine[] row and choose more..
Now, get back to your Excel and copy the name of one of the cp-xxx objects. Use your browser’s search feature to find the objects.You need to write down the vm-xxxx nr. of each object:

Remove the lock from the Instant Clone cp-xxx objects
In the following steps we will use MOB to remove the lock from Instant Clone cp-xxx objects.
Log on to the vCenter Server MOB.
To do this, type the following behind the FQDN of your vCenter Server: /mob/?vmodl=1.
Example: https://vcsa-fqdn/mob/?vmodl=1
After you logged on (use the administrator@vsphere.local account, or equal privileges) to the MOB, Browse to Content.
Browse to Content > AuthorizationManager
If one of these options is missing, close all your browser windows and retry OR open an incongnito window.Navigate to vim.AuthorizationManager.EntityDisabledMethodInfo[] > enableMethods, A new browser tab will open with three fields: Entity, Method and SourceID.
We go back to the Excel list with the locked cp-xxx objects and the vm-xxxx numbers correlated to the them. We need those vm-xxxx numbers in the steps below.Copy/Paste the XML content from the first code block below to the entity > vim.ManagedEntity[] value.
<!--array start -->
<entity type="ManagedEntity" xsi:type="ManagedObjectReference">vm-0001</entity>
<entity type="ManagedEntity" xsi:type="ManagedObjectReference">vm-0002</entity>
<entity type="ManagedEntity" xsi:type="ManagedObjectReference">vm-0003</entity>
<entity type="ManagedEntity" xsi:type="ManagedObjectReference">vm-0004</entity>
<entity type="ManagedEntity" xsi:type="ManagedObjectReference">vm-0005</entity>
<!--array end -->Change the vm-xxx object names to the names you correlated during the preparations.
Copy/Paste the XML content from the second code block below to the method > vmodl.MethodName[] value.
<!-- array start -->
<entity type="MethodName" xsi:type="string">vim.VirtualMachine.unregister</entity>
<entity type="MethodName" xsi:type="string">vim.VirtualMachine.powerOff</entity>
<entity type="MethodName" xsi:type="string">vim.VirtualMachine.powerOn</entity>
<entity type="MethodName" xsi:type="string">vim.ManagedEntity.destroy</entity>
<!-- array end -->
When done, choose Invoke Method in the right bottom.The command will run for about 1 minute.
After running these commands, the lock on the cp-xxx objects have been removed.
You can now delete the cp-xxx objects using the GUI.

If you’re new to VMware Horizon DaaS, check out our Horizon DaaS Explained series here!


[…] explained how you can do it in the GUI, so if you are not familiar with scripting/PowerShell then this blog is a good […]
Why dont I see enable method? I’m usung vcenter 6.7
Many thanks Marc, I have delete the orphaned folder “VMwareViewComposerReplicaFolder” It works … thanks & Bye p.s. VCSA v6.7update3