I’ve been playing around with Horizon View 7 for a while now. Discovering the instant clones etc and I really started liking it.
I used the instant clone feature of Horizon view. All together this works extremely well, but from time to time you might encounter something called orphaned clones (atleast if you mess around with it as much as I did).
Horizon view creates seperate VM’s (parent VM’s or replica’s depending on the setup) of your template machine. Sometimes the database of the Horizon View server and the vCenter server can get out of sync.
A desktop pool might seem deleted in the Horizon View administrator panel but the clones can still be there in vCenter.
Since these clones are protected, you can not delete them manually.
Some blogs write about a ‘fast’ solution: deleting the ESX host from your vCenter, remove the clones when logging in directly on the ESX server and add the server again to vCenter.
This does work, but when you use for example dvSwitches or have a lot of VM’s on the ESX this is NOT a good option:
- The ESX host has to be put in maintenance mode. So you have to shutdown or migrate all VM’s
- If you use dvSwitch then you have to remove and add the server to the switch again, and reconfigure the VM networks
Searching on google I found a couple of references to the “SviConfig” command line tool. But it seems that this is not for Horizon 7. The directory is not present (or at least was not present on my server). For reference: if you use Horizon View 5 or 6 you should check this link. It explains how to unlock the orphaned clones.
Now back to my Horizon 7 setup. I started looking around in the Horizon View folders and found a “tools” directory. And there was my solution. Instead of the SviConfig tool there now is a small batch script (calling a jar file) that allows unlocking the clones.
Navigate to the tools dir:
cd "C:\Program Files\VMware\VMware View\Server\tools\bin"
In that dir call the icunprotect file. It takes a couple of command line arguments
usage: CpUnprotect.bat -vc -uid -password [-clusterId ] [-includeFolders] Set host maintenance mode utility for ClonePrep -vc *vCenter hostname/ip -uid *vCenter User Id -password *vCenter password -clusterId Cluster ID (optional) -includeFolders Unprotect folders also * Required arguments If no clusterId is provided then protection will be removed from all ClonePrep VMs in all datacenters
So the actual command would be:
PS C:\Program Files\VMware\VMware View\Server\tools\bin> .\icunprotect.cmd -vc vcenter.yourdomain.local -uid Administrator@vsphere.local -password SuperDeluxePassword -includefolders
Et voila! you are now able to delete the orphaned clones directly from vCenter: