How-To
How to Delete VMware Horizon Instant Clones
Although VMware Horizon instant clones are easy to set up and maintain, removing them from an environment can be problematic as certain objects in vSphere are not always removed when an instant clone pool is deleted. Luckily, VMware offers a tool that makes it easy to remove these objects, and Tom Fenton helps you become familiar with this problem and learn how to resolve it.
VMware Horizon instant clone technology is wonderful in that it can save recourses and speed up the deployment of virtual desktops. I have written on instant clones before (see "How To Use VMware Instant Clone, Part 1: Setup and Installation" and Part 2), and use them in my own environment. Although instant clones are easy to set up and maintain, removing them from an environment can be problematic as certain objects in vSphere are not always removed when an instant clone pool is deleted. Luckily, VMware offers a tool that makes it easy to remove these objects. In this article, I will help you become familiar with this problem and learn how to resolve it.
Problem
To help demonstrate this issue, I created an instant clone pool called ICPool01, which had four machines associated with it. I then deleted the pool using Horizon Administrator.
Instant clones also create other cp-parent and cp-replicate objects. I have noticed in the past that after I delete an instant clone desktop pool with Horizon Administrator, these other objects are sometimes removed and other times they are not. In this instance, they were not.
These objects do not consume any CPU or RAM, but they do consume storage.
When I tried to manually delete these objects, I found that the Remove from inventory and Delete from disk options are grayed out.
Solution
VMware realized that the inability to delete clones is an issue and has made some command-line tools to deal with it:
- IcUnprotect.cmd – To unprotect folders and VMs, delete VMs, and detect VMs whose master image or snapshot has been deleted.
- IcMaint.cmd – To delete the master images, which are of the parent VM in vCenter Server, from the ESXi host, so that the host can be put into maintenance mode. In Horizon 7.0.3, this utility is the only method to prepare an Instant Clone ESXi host for maintenance mode.
- IcCleanup.cmd – To unprotect and delete some or all the internal VMs created by instant clones. This command is available in Horizon versions 7.10 and newer.
All three of these tools are installed by default when you install the VMware Horizon Connection Server. The command that I will focus on and show you how to use is IcCleanup.cmd.
To use the IcCleanup.cmd command, launch a command Window as Administrator and change to the C:\Program Files\VMware\VMware View\Server\tools\bin directory.
The syntax for the command is iccleanup.cmd -vc vcName -uid userId [-skipCertVeri] [-clientId clientUuid]. For example, to enter my environment which has a vCenter server at 10.0.0.22, I would enter iccleanup.cmd -vc 10.0.0.22 -uid [email protected] -skipCertVeri.
Entering list shows the instant clone objects that are protected. You can then delete these objects by matching up the name of the object with the entity you want to delete.
In my case, I wanted to delete the objects with a parent of cp-parent 88500df7, which was listed under "2."
I entered delete –index 2.
This unprotected the objects and deleted them.
This also removed all objects except the cp-replica, which was under index 1. I was able to delete this object by entering delete –index 1.
Conclusion
Instant clones have been around for many years now, and VMware has indicated that they are the future of its just-in-time desktop strategy. I haven't had any major issues with them, but cleaning up a deleted environment requires a few manual steps to complete.
VMware has documentation on these commands (located here), but it is rather sparse and shows options that I could not get to work with iccleanup.cmd.
About the Author
Tom Fenton has a wealth of hands-on IT experience gained over the past 30 years in a variety of technologies, with the past 20 years focusing on virtualization and storage. He previously worked as a Technical Marketing Manager for ControlUp. He also previously worked at VMware in Staff and Senior level positions. He has also worked as a Senior Validation Engineer with The Taneja Group, where he headed the Validation Service Lab and was instrumental in starting up its vSphere Virtual Volumes practice. He's on X @vDoppler.