Save the commands outlined in red into a .ps1 script file. Run the script using PowerCLI from the vCenter server. In case of an appliance, run it from any machine that has PowerCLI installed.
$vcserver = "vcenter.domain.com" $vcusername = "vcenter_admin" $vcpassword = "password" Connect-VIServer -Server $vcserver -User $vcusername -Password $vcpassword $allVMs=Get-VM foreach ($vm in $allVMs) { if ($vm.ExtensionData.Runtime.ConnectionState -eq "orphaned") {$vm | Remove-VM} } If you get an error about the Remove-VMmethod being disabled by horizon.daas, you will first need to unprotect folders in vCenter. To do that run the following command using PowerCLI on the Horizon Connection Broker. IcUnprotect.cmd -vc hostname_or_IP_address -uid user_ID -password password [-clusterId cluster_ID] [-includeFolders] Once folders have been unprotected, re-run the original script.
This has been resolved in vCenter 5.0 Update 2 as well as 5.1 Update 1. To fully resolve this issue after updating the vCenter Server, add the provisioning.relocate.enableRename advanced parameter to vCenter Server and set its value to true:
Log into the vSphere Client as an Administrator.
Click Administration > vCenter Server Settings.
Click Advanced Settings.
Add this advanced parameter Key: provisioning.relocate.enableRename
Set the value to: true
Click OK.
Restart the VMware VirtualCenter Server service for the changes to take effect.