After reinstalling composer server in my lab I was left with some orphaned replicas in the lab. While I was able to delete the virtual desktop VMs it was not possible to delete those replicas VM from within the vSphere client as the option is grayed out. The replica VM has some strange name as you can see.
So what's the options? In fact the only option is a command line utility called sviconfig installed on the composer server. Well there are two and I'll show you the more easy one as the one provided by VMware KB 1008704 did not work and I had error code 11 all the time when executing the command on my View Composer server:
sviconfig -operation=UnprotectEntity -DsnName=name_of_DSN -DbUsername=Composer_DSN_User_Name -DbPassword=Composer_DSN_Password -VcUrl=https://vCenter_Server_address/sdk -VcUsername=Domain\User_of_vCenter_Server_account_name -VcPassword=vCenter_Server_account_password -InventoryPath=/Datacenter_name/vm/VMwareViewComposerReplicaFolder -Recursive=true
Note: If you receive Error code 11 when you run the command and your replicas are in a folder and not directly under the Data center. The path should be manually substituted in place of VMwareViewComposerReplicaFolder.
Here you can see that the right click do not allows you to delete the replica like that.
How-to delete orphaned Horizon View replica
The problem is the replica VM can't be deleted in the normal circumstances, but it can be deleted when you connect to the ESXi host directly! Sure, you can delete the view replica by connecting directly to the host (not vCenter), but vCenter view is not updated and the replica is still present there.
You need to proceed with this steps:
Select the cluster view > disconnect host > remove > and add the ESXi host back to vCenter and you're done! The reference to the replica is gone!
All this can be done in less than 5 min. -:)